Code example for HandlerThread

Methods: getLooperstart

0
	public void onCreate() { 
		// TODO: It would be nice to have an option to hold a partial wakelock 
		// during processing, and to have a static startService(Context, Intent) 
		// method that would launch the service & hand off a wakelock. 
		super.onCreate(); 
		HandlerThread thread = new HandlerThread("IntentService[" + mName + "]");
		thread.start();
 
		mServiceLooper = thread.getLooper();
		mServiceHandler = new IntentServiceHandler(mServiceLooper, this);
	} 
 
	@Override 
	public void onStart(Intent intent, int startId) {
		Message msg = mServiceHandler.obtainMessage();
		msg.arg1 = startId;
		msg.arg2 = 0;
		msg.obj = intent;
		mServiceHandler.sendMessage(msg);
	} 
Stop searching for code, let great code find you!  Add Codota to your java IDE