0

新的对话框框架类没有被调用是这样的..??它烤消息以及异常中的烤面包

public class AlarmReceiver extends BroadcastReceiver {

 @Override
 public void onReceive(Context context, Intent intent) {
   try {
     Bundle bundle = intent.getExtras();
     String message = bundle.getString("alarm_message");
     Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
     Intent newIntent = new Intent(context, FireMissilesDialogFragment.class);
    newIntent.putExtra("alarm_message", message);
     newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  //   Toast.makeText(context, "1"+message, Toast.LENGTH_SHORT).show();

     context.startActivity(newIntent);
   //  Toast.makeText(context, "2"+message, Toast.LENGTH_SHORT).show();

    } catch (Exception e) {
     Toast.makeText(context, "There was an error somewhere, but we still received an alarm", Toast.LENGTH_SHORT).show();
     e.printStackTrace();

    }
 }

}
4

1 回答 1

0

您不能通过意图启动片段 - 您需要启动活动

于 2012-11-29T21:20:28.087 回答