i'm trying update progress bar of asynctask doesn't changed.from doinbackground i'm passing values onprogreessupdate going on there changes doesn't reflect on progreesdailog.
please have , give me reason why happening.
asynctask class
class export extends asynctask<string, integer, string> { progressdialog dialog; public export() { dialog = new progressdialog(inventorycount.this); dialog.setcancelable(false); } protected void onpreexecute() { super.onpreexecute(); dialog.setmessage("please wait while exporting worksheet.."); dialog.show(); dialog.setprogress(0); dialog.setmax(100); } protected string doinbackground(string... results) { string result = ""; strictmode.threadpolicy policy = new strictmode.threadpolicy.builder() .permitall().build(); strictmode.setthreadpolicy(policy); mis_setting mis_setting = new mis_setting(); dbhelper.getreadabledatabase(); mis_setting = dbhelper.getsetting(); dbhelper.close(); string ipaddress = mis_setting.getipaddress(); string f_url = "http://" + ipaddress + "/miswcfservice/service.svc/putmic"; dbhelper.getreadabledatabase(); int count = getcount(); dbhelper.close(); int length = count / 5; (int = 0; <= length; i++) { int progress=(int) ((i / (float) (count / 5)) * 100); publishprogress(progress); try { thread.sleep(500); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } } protected void onprogressupdate(integer... progress) { //super.onprogressupdate(progress); //dialog.setprogress(progress[0]);; // setprogress(progress[0]); super.onprogressupdate(progress); // update progressbar dialog.setprogress(progress[0]); } protected void onpostexecute(string result) { if (result.equals("success")) { dialog.dismiss(); //some other stuffs } } }
Comments
Post a Comment