Android interview: IntentService source code analysis
发布时间
阅读量:
阅读量
}
@Override
public void onDestroy() {
System.out.println(“onDestroy”);
super.onDestroy();
}
}
我已将整个生命周期中的相关方法全部输出,稍后我们将观察其具体执行流程。随后是Activity部分,在Activity中将用于启动IntentService:
public class TestActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//可多次调用,每次启动都会创建一个新的工作线程,但IntentService的实例在整个过程中仅存在一个
//操作1
Intent startServiceIntent = new Intent(“com.test.intentservice”);
Bundle bundle = new Bundle();
bundle.putString(“
全部评论 (0)
还没有任何评论哟~
