zoukankan      html  css  js  c++  java
  • 按Notification 回到正在运行的activity

      写好Notification , 按Home回到主界面,再按通知栏的消息(Notification), 回到退出之前正在运行的Acticity .

        在代码中加入两行代码作为声名即可。 :

                     
                     Intent notificationIntent = new Intent(this,this.getClass()); 

                    /* */
                    notificationIntent.setAction(Intent.ACTION_MAIN);
                    notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
                     

                    PendingIntent contentIntent = PendingIntent.getActivity(this.context, 0, notificationIntent,PendingIntent.FLAG_UPDATE_CURRENT);
                    notification.setLatestEventInfo(context, title, text, contentIntent);        
                    mNotificationManager.notify(NOTIFICATION_SERVICE_ID,notification);

  • 相关阅读:
    kafka搭建
    kafaka学习笔记
    metastore 简单说明
    二 python并发编程之多进程-理论
    文件指针偏移量
    FTP
    1 并发编程
    操作系统简介
    1 网络编程
    网络编程-osi七层
  • 原文地址:https://www.cnblogs.com/xilinch/p/2749593.html
Copyright © 2011-2022 走看看