process - Android: How to Make toast when ProgressDialog finishes -
i have activity in user needs download databases external source.
i want add toast when download finished or on progressdialog dismiss. can please me out, here's progressdialog ..
progressdialog barprogressdialog; handler updatebarhandler; { updatebarhandler = new handler();} public void launchringdialog(view view) { final progressdialog ringprogressdialog = progressdialog.show(emailhacker.this, "please wait ...", "downloading data...", false); ringprogressdialog.setcancelable(false); new thread(new runnable() { @override public void run() { try { thread.sleep(30000); } catch (exception e) { } ringprogressdialog.dismiss(); } }).start(); }
to call asynctask-
new task1().execute(); code-
class task1 extends asynctask<void, void, string> { @override protected void onpreexecute() { super.onpreexecute(); final progressdialog ringprogressdialog = progressdialog.show(emailhacker.this, "please wait ...", "downloading data...", false); ringprogressdialog.setcancelable(false); } @override protected string doinbackground(void... arg0) { try { //do something... thread.sleep(30000); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } return null; } @override protected void onpostexecute(string result) { super.onpostexecute(result); ringprogressdialog.dismiss(); toast.maketext(emailhacker.this, "message", toast.length_long).show(); } } }
Comments
Post a Comment