- private TextView tv;
- private ProgressDialog pd;
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- setContentView(R.layout.main);
- tv = (TextView) this.findViewById(R.id.main);
- tv.setText("Press any key to start calculation");
- }
- @Override
- pd = ProgressDialog.show(this, "Working..", "Calculating Pi", true,
- false);
- thread.start();
- return super.onKeyDown(keyCode, event);
- }
- public void run() {
- pi_string = Pi.computePi(800).toString();
- handler.sendEmptyMessage(0);
- }
- private Handler handler = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- pd.dismiss();
- tv.setText(pi_string);
- }
- };
- }
2010년 12월 29일 수요일
Progress Dialog
피드 구독하기:
댓글 (Atom)
댓글 없음:
댓글 쓰기