안드로이드 로딩중 표시 띄우기

2012. 12. 20. 12:51Development/[Android] 안드로이드

728x90
private ProgressDialog progressDialog;

private void createThreadAndDialog(){
		  progressDialog = ProgressDialog.show(getContext(), getTextFilter(), "데이터를 로딩중입니다");  
		  Thread thread = new Thread(new Runnable() {
		            public void run() {
		            		try {
								Thread.sleep(2000);
							} catch (InterruptedException e) {
								// TODO Auto-generated catch block
								e.printStackTrace();
						    }
		                    fristhandler.sendEmptyMessage(0);
		            }
		        });
		  		
		        thread.start();
		 }

	@SuppressLint("HandlerLeak")
	private Handler fristhandler = new Handler() {
	        public void handleMessage(Message msg) {
	         progressDialog.dismiss();
	        }    
	 };

728x90
반응형