0

我的通知栏是这样的结构:

             Notification notification = new Notification(R.drawable.full,+level+"%",System.currentTimeMillis());

             notification.flags = Notification.FLAG_ONGOING_EVENT;

             Intent i = new Intent(context, MainActivity.class); 

             PendingIntent penInt = PendingIntent.getActivity(getApplicationContext(), 0 , i , 0);

             notification.setLatestEventInfo(getApplicationContext(), "Batteria al"+" "+level+"%", "Clicca per aprire l'applicazione", penInt);

             notifi.notify(215,notification);

        }   

但我不知道如何用这种结构设置 .setTicker 。我该怎么做?谢谢

4

1 回答 1

2
Notification notification = new Notification(R.drawable.full,+level+"%",System.currentTimeMillis());

在这一行中,第二个参数是股票代码文本。您不需要使用其他方法进行设置。

顺便说一句,这个构造函数已被弃用。改用Notification.Builder _

通过使用

 Notification noti = new Notification.Builder(mContext)
         .setContentTitle("New mail from " + sender.toString())
         .setContentText(subject)
         .setSmallIcon(R.drawable.new_mail)
         .setLargeIcon(aBitmap)
         .setTicker(tickerText)
         .build();
于 2013-07-03T16:56:14.117 回答