- 사용자로부터 기다리임 요구될때 ProgressDialog 같은 것을 사용 한다.
- 쓰레드를 통한 구현임으로 함수만 가져다 쓰면 간편하게 사용 할 수 있다.
-Java 소스
}
- 실행 화면
- 쓰레드를 통한 구현임으로 함수만 가져다 쓰면 간편하게 사용 할 수 있다.
-Java 소스
public class ProgressDialogActivity extends Activity implements OnClickListener {
ProgressDialog dialog;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btn = (Button) this.findViewById(R.id.btn);
btn.setOnClickListener(this);
}
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
timeThread();
}
public void timeThread() {
dialog = new ProgressDialog(this);
dialog = new ProgressDialog(this);
dialog.setTitle("Wait...");
dialog.setMessage("Please wait while loading...");
dialog.setIndeterminate(true);
dialog.setCancelable(true);
dialog.show();
new Thread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
try {
Thread.sleep(5000);
} catch (Throwable ex) {
ex.printStackTrace();
}
dialog.dismiss();
}
}).start();
}
- 실행 화면
'JAVA > Android' 카테고리의 다른 글
안드로이드 Table(TableRow) 예제 따라하기 (2) | 2012.02.01 |
---|---|
안드로이드 MediaPlayer 간단한 예제 (0) | 2012.01.31 |
안드로이드 알람(Alarm,Notification) 예제 따라하기 (1) | 2012.01.27 |
안드로이드 FingerPaint(그림판) 예제 따라하기 (1) | 2012.01.26 |
안드로이드 BroadcastReceiver를 이용한 문자 메시지 받기 예제 따라하기 (0) | 2012.01.25 |