This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleActivity extends Activity implements Handler.Callback { | |
private static final int MSG_START_OP = 1; | |
private static final int MSG_PAUSE_OP = 2; | |
private static final int MSG_SEND_ALIVE_OP = 3; | |
private HandlerThread mHT; | |
private Handler mMsgHandler; | |
@Override | |
void onCreate(Bundle savedInstance) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Example code to help with Stack Overflow post: | |
* http://stackoverflow.com/questions/35843374/android-pausing-service-thread-asynctask-using-a-handler-with-postdelayed-for | |
* | |
* THIS IS JUST SAMPLE CODE, HAS NOT BEEN BUILT OR TESTED. | |
*/ | |
public class MyService extends Service { | |
protected static final DEFAULT_TIMEOUT = 5000; | |
protected static final EXTENDED_TIMEOUT = 20000; | |