Code example for ProgressDialog

Methods: getProgresssetMaxsetMessagesetProgress

0
			int size = msg.arg2; 
									 
			switch(msg.what) { 
			case DIALOG_UPDATE: 
				String name = (String)msg.obj; 
				mProgress.setMessage("Sending " + name); 
				mProgress.setMax(size); 
				mProgress.setProgress((mProgress.getProgress() + progress) / size); 
				break; 
				 
			case DIALOG_CANCEL: 
				String error = (String)msg.obj; 
				 
				mProgress.cancel(); 
				Toast.makeText(BluetoothActivity.this,  
						   	   "Error, " + error,  
						       Toast.LENGTH_LONG).show(); 
				break; 
				 
			case DIALOG_FINISH: 
				mProgress.cancel();