How to update progress Dialog text every 5sec in android? Code Answer

I want change Progress dialog text dynamically every 5sec …. while syncing data tables from MySQL to sqlite … i tried using custom class but still text not changing for every 5s . thanks in advance.


You can try using a handler with postDelayed:

Handler handler = new Handler();

public void checkProgress() {

    handler.postDelayed(new Runnable(){
               public void run() {
                    boolean done = false;
                    mytextView.setText("updated Text");

                    // Some logic here to check when progress is done, then flip boolean

                    if (!done) {
        }, 5000);

I didnt test any of this code but this might get you on the right track.

Related Posts

© No Copyrights, All Questions are retrived from public domain.
Tutorial Guruji