Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/199.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android-触摸通知时提示对话框窗口_Android_Dialog_Notifications - Fatal编程技术网

Android-触摸通知时提示对话框窗口

Android-触摸通知时提示对话框窗口,android,dialog,notifications,Android,Dialog,Notifications,我是android应用程序开发新手。我正在为我最后一年的项目做申请 我的应用程序将提醒用户预约。到目前为止,我设法在约会日期的通知栏上显示警报 我的主管要求添加一个功能,即当通知栏上的用户选项卡出现时,将出现一个对话框窗口并显示详细信息(约会标题和地点) 如何实现这一点?尝试以下方法: Intent notifyIntent = new Intent(context,YourActivityClassHere.class); notifyIntent.setFlag(Intent.FLAG_AC

我是android应用程序开发新手。我正在为我最后一年的项目做申请

我的应用程序将提醒用户预约。到目前为止,我设法在约会日期的通知栏上显示警报

我的主管要求添加一个功能,即当通知栏上的用户选项卡出现时,将出现一个对话框窗口并显示详细信息(约会标题和地点)

如何实现这一点?

尝试以下方法:

Intent notifyIntent = new Intent(context,YourActivityClassHere.class);
notifyIntent.setFlag(Intent.FLAG_ACTIVITY_NEW_TASK);
//UNIQUE_ID if you expect more than one notification to appear
PendingIntent intent = PendingIntent.getActivity(SimpleNotification.this, UNIQUE_ID, 
            notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT);
  • 让悬挂式帐篷打开你的一项活动
  • 使该活动完全透明并打开一个对话框
  • 如果要从通知打开活动,请单击事件:

    假设notif是您的通知对象:

    Intent notificationIntent = new Intent(this.getApplicationContext(), ActivityToStart.class);
    PendingIntent contentIntent = PendingIntent.getActivity(this.getApplicationContext(), 0, notificationIntent, 0);
    notif.contentIntent = contentIntent;
    

    如需其他帮助,您可以查看此内容,它将帮助您:

    当然……请尽快通知我……@@@i是否应该进行新的活动?或者我可以将其添加到提醒活动中?哎呀,亲爱的,你必须创建自己的新活动,我在回答中将其命名为“YourActivityClassHere”。嗨,如果我想通过按通知打开我应用程序的一个活动,该怎么办?现在不要问我,如何在JAVA中创建对象…!!:(