Progress Dialog and Threads
From John Freier
Revision as of 09:04, 27 January 2011 by Jfreier (Talk | contribs) (Created page with ' private Handler handlerRefresh = new Handler() { @Override public void handleMessage(Message msg) { // Code to process the response and update UI. …')
private Handler handlerRefresh = new Handler()
{
@Override
public void handleMessage(Message msg)
{
// Code to process the response and update UI.
Bundle resBundle = (Bundle) msg.obj;
String question = resBundle.getString(BUNDLE_QUESTION);
}
}
...
dialog = ProgressDialog.show(CurrentActivity.this, "","Posting to twitter...", true);
new Thread(new Runnable()
{
public void run()
{
TwitterPost.Post(getBaseContext(), tweetString);
Message myMessage=new Message();
Bundle resBundle = new Bundle();
resBundle.putString(BUNDLE_USER_ANSWER, tweetString);
myMessage.obj=resBundle;
handlerTwitterPost.sendMessage(myMessage);
dialog.dismiss();
}
}).start();
...
private ProgressDialog dialog;