我是安卓程序的初学者,我只是在读IntentServices。我有一个疑问--如果我从扩展IntentService的类中发出对另一个类扩展IntentService的调用,该调用是否有效?
作为一个整体,像这样的事情-
public class MyIntentService extends IntentService{
@Override
public void onHandleIntent(Intent intent){
//do stuff with incoming intent
Intent newIntent = new Intent(getApplicationContext(), ABC.class);
//ABC.class is another class extending IntentService
startService(newIntent);
}
}这个能行吗?
发布于 2016-03-14 16:55:41
您可以从意图服务开始活动,但需要向其添加NEW_TASK标志。
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);您还可以从一个IntentService启动另一个IntentService。
https://stackoverflow.com/questions/35993494
复制相似问题