progressdialog - Android - progress dialog does not close -


i have listactivity class, , when item on list clicked, new activity displayed. new activity takes time load, users know there happening (in form of progress dialog)

so, in order this, implemented runnable in class -

public class protocollistactivity extends listactivity implements runnable { private progressdialog progdialog; .... protected void onlistitemclick(listview l, view v, int position, long id) {                     progdialog.show(this, "showing data..", "please wait", true, false);      thread thread = new thread(this);     thread.start(); } .... public void run() {      // code start new activity based on item user has clicked. } 

initially, when click, , new activity being loaded, progress dialog works nicely, when close previous activity (to list) progress dialog still running. want progress dialog show time new activity being started.

can please guide me on how correctly.

dialogs needs explicitly removed programmer (or close user). so, should done in way:

in activity (calling activity)

protected void onlistitemclick(listview l, view v, int position, long id) {     progdialog.show(this, "showing data..", "please wait", true, false);      thread thread = new thread(this){         // heavy weight work          // activity prepared fire          progdialog.dismiss();     };     thread.start(); } 

although in use case, heavy work should on callee activity. in case, heavy work done oncreate of callee, should like:

activity b (callee):

oncreate(){     progdialog.show(this, "showing data..", "please wait", true, false);      thread thread = new thread(this){         // heavy weight work          // ui ready          progdialog.dismiss();     };     thread.start(); } 

anyway, idea still same.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -