Android通知无法正常工作

时间:2011-01-14 17:47:10

标签: android notifications

我有以下代码。问题是,当我点击通知栏时(当应用程序启动时,我看到文本内部:通过Firstdroid.com 文本,但没有别的,即使我点击栏。

  NotificationManager mNotManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

    String MyText = "Text inside: By Firstdroid.com";
    Notification mNotification = new Notification(
           R.drawable.icon,                // An Icon to display
           MyText,                         // the text to display in the ticker
           System.currentTimeMillis()       ); // the time for the notification
    mNotification.defaults |= Notification.DEFAULT_SOUND;
    String MyNotifyTitle = "Firstdroid Rocks!!!";
    String MyNotifiyText  = "Firstdroid: our forum at www.firstdroid.com";
    Intent MyIntent = new Intent( getApplicationContext(), HelloAndroid2.class );

    MyIntent.putExtra("extendedTitle", MyNotifyTitle);
    MyIntent.putExtra("extendedText" , MyNotifiyText);
    PendingIntent StartIntent = PendingIntent.getActivity(getApplicationContext(),0,MyIntent,PendingIntent.FLAG_CANCEL_CURRENT);

    mNotification.setLatestEventInfo(   getApplicationContext(),
            MyNotifyTitle,
            MyNotifiyText,
            StartIntent);

    /* Sent Notification to notification bar */
    mNotManager.notify(  SIMPLE_NOTIFICATION_ID , mNotification );  

1 个答案:

答案 0 :(得分:0)

我写这篇文章是为了结束这个问题。

之前的评论复制: 我解决了。没有问题,我只是不知道我不得不拉下通知而不是点击绿色的记事本按钮