Step 1: Create Global Handler Class.
private EventHandler mEventHandler = new EventHandler();
class EventHandler extends Handler {
int tempMsg = 0;
@Override
public void handleMessage(Message msg) {
try {
switch (msg.what) {
case 1:
// call method whatever you want.
break;
dialog.dismiss();
} catch (Exception e) {
Log.d("XReader", "Error in " + e.getMessage());
}
}
};
step2: call Hender using Msg
ProgressDialog dialog = ProgressDialog.show(XReaderActivity.this, "", "Please wait",true);
Message message = new Message();
message.what = 1;
mEventHandler.sendMessage(message);
No comments:
Post a Comment