Difference between revisions of "Progress Dialog and Threads"
From John Freier
Line 11: | Line 11: | ||
} | } | ||
− | dialog = ProgressDialog.show(CurrentActivity.this, ""," | + | dialog = ProgressDialog.show(CurrentActivity.this, "","Please wait...", true); |
new Thread(new Runnable() | new Thread(new Runnable() | ||
{ | { | ||
public void run() | public void run() | ||
{ | { | ||
− | + | // Threaded process... | |
+ | String name = "John"; | ||
Message myMessage=new Message(); | Message myMessage=new Message(); | ||
Bundle resBundle = new Bundle(); | Bundle resBundle = new Bundle(); | ||
− | resBundle.putString( | + | resBundle.putString("key", name); |
myMessage.obj=resBundle; | myMessage.obj=resBundle; | ||
− | + | handlerRefresh.sendMessage(myMessage); | |
dialog.dismiss(); | dialog.dismiss(); | ||
} | } | ||
}).start(); | }).start(); |
Revision as of 09:09, 27 January 2011
private ProgressDialog dialog;
private Handler handlerRefresh = new Handler() { @Override public void handleMessage(Message msg) { Bundle resBundle = (Bundle) msg.obj; String question = resBundle.getString("key"); } }
dialog = ProgressDialog.show(CurrentActivity.this, "","Please wait...", true); new Thread(new Runnable() { public void run() { // Threaded process... String name = "John"; Message myMessage=new Message(); Bundle resBundle = new Bundle(); resBundle.putString("key", name); myMessage.obj=resBundle; handlerRefresh.sendMessage(myMessage); dialog.dismiss(); } }).start();