Adn*_*aki 1 android broadcastreceiver android-fragments
我怎样才能使用广播接收器来启动/午餐片段:例如:如果我需要启动/关闭活动,我可以使用意图:
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();
    }
}
但我不知道片段怎么样
| 归档时间: | 
 | 
| 查看次数: | 2331 次 | 
| 最近记录: |