这个例子很简单,打开线程处理任务变得很轻松:
原文:Display a progress dialog while computing
原创内容如转载请注明:来自 阿权的书房
final ProgressDialog dialog = ProgressDialog.show(this, "Title", "Message", true);
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
dialog.dismiss();
}
};
Thread checkUpdate = new Thread() {
public void run() {
//
// YOUR LONG CALCULATION (OR OTHER) GOES HERE
//
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
final Handler handler = new Handler() {
public void handleMessage(Message msg) {
dialog.dismiss();
}
};
Thread checkUpdate = new Thread() {
public void run() {
//
// YOUR LONG CALCULATION (OR OTHER) GOES HERE
//
handler.sendEmptyMessage(0);
}
};
checkUpdate.start();
原文:Display a progress dialog while computing
原创内容如转载请注明:来自 阿权的书房
收藏本文到网摘
新家具:蓝色收纳柜
android全屏和timestamp
