Here
What is Looper?
Where we can use Looper class?
If someone wants to execute multiple messages
HandlerThread hThread = new HandlerThread("HandlerThread"); hThread.start(); Handler handler = new Handler(hThread.getLooper()); final Handler handler1 = new Handler(hThread.getLooper()); final long oneMinuteMs = 60 * 1000; Runnable eachMinute = new Runnable() { @Override public void run() { Log.d(TAG, "Each minute task executing"); handler1.postDelayed(this, oneMinuteMs); sendPostRequest(); } }; // sendPostRequest(); // Schedule the first execution handler1.postDelayed(eachMinute, oneMinuteMs);
No comments:
Post a Comment