Notification notification = new Notification(R.drawable.stat_sample,
getText(R.string.new_friend_request_exist),
System.currentTimeMillis());
Intent i = new Intent(this, UnApprovedFriendList.class);
i.putExtra(FriendInfo.FRIEND_LIST, tmp);
PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
i, 0);
notification.setLatestEventInfo(this, getText(R.string.new_friend_request_exist),
"You have new friend request(s)",
contentIntent);
以上代码有什么问题?....................................... .................................................. .................................................. ..
答案 0 :(得分:2)
是因为它是弃用的方法。 你可以用
NotificationCompat.Builder builder = new NotificationCompat.Builder(
this);
myNotification = builder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.yourstring)
.setTicker(notificationText).setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentTitle(getText(R.string.title))
.setContentText(notificationText).build();