







public class AndroidsCastleActivity extends Activity implements Runnable {
private ProgressDialog _progressDialog;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
_progressDialog = new ProgressDialog(this);
_progressDialog.setTitle("レンダリング中");
_progressDialog.setMessage("しばらくお待ちください...");
_progressDialog.setIndeterminate(true); //進捗が分からないことを示す
_progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);//クルクル回るタイプのダイアログ
_progressDialog.show(); //表示開始
Thread thread = new Thread(this);
thread.start();
}
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {}
//ここに時間のかかる処理を記述
handler.sendEmptyMessage(0);
}
private Handler handler = new Handler() {
public void handleMessage(Message msg) {
//終了処理を記述
_progressDialog.dismiss(); //ダイアログの終了
}
};
}
Portions of this page are modifications
based on work created and shared by Google and used according to terms
described in the Creative Commons 3.0 Attribution License.
- Remical Soft -