10 Service02
时间:2014-04-29 18:02:50
收藏:0
阅读:432
package com.szy.service; import android.app.IntentService; import android.content.Intent; import android.util.Log; public class ExampleIntentService extends IntentService { protected static final String TAG = "IntentActivity"; public ExampleIntentService() { super("ExampleIntentService"); } @Override protected void onHandleIntent(Intent intent) { try { Log.i(TAG, "MyService线程ID:"+Thread.currentThread().getId()); Log.i(TAG, "文件下载...."); Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } } }
IntentService在
onHandleIntent(Intent intent)中实现异步操作。
评论(0)