我想从我的广播接收器开始多个活动。我有两个类,即ReadContacts和CallDetails。我想一个接一个地开始。像第一个calldetails活动应该开始,然后下一个。我已经尝试了下面的代码,它工作正常。从broadcastReceiver开始multilple活动
Intent calldetails = new Intent();
calldetails.setClassName("com.simplereader", "com.simplereader.Calldetails");
calldetails.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(calldetails);
然后,我尝试下面的代码,开始其他活动
Intent readcontacts = new Intent();
readcontacts.setClassName("com.simplereader", "com.simplereader.ReadContacts");
calldetails.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
context.startActivity(readcontacts);
但其没有工作和应用程序崩溃。
请详细说明。 –
或任何代码片段 –
我编辑了我的答案 – codeMagic