我如何使用广播接收器来启动/午餐片段 例如: 如果我需要开始/ luanch活动,我可以用意图:我怎么能在广播接收器发射片段
public void onReceive(final Context context, Intent intent) {
this.context = context;
this.intent = intent;
try {
Bundle bundle = intent.getExtras();
int messageID = bundle.getInt("id");
intent = new Intent(context, GetAlarm.class);
intent.putExtra("id",messageID);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
} catch (Exception e) {
Toast.makeText(context, "There was an error ", Toast.LENGTH_SHORT)
.show();
e.printStackTrace();
}
}
,但我不知道有关片段