1
我试图在android中创建通知。该图标显示不清,文字变得颤抖。当你点击它时,Intent也不会被调用。 (我有一个测试意图,应该调出网页浏览器)。 我不明白为什么文本消失,当我点击sttus栏时,浏览器不出现。 代码Android试图弄清楚如何创建通知
public class Welcome extends Activity
{
private NotificationManager mNotificationManager;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mNotificationManager = (NotificationManager)
getSystemService(NOTIFICATION_SERVICE);
Notification notifyDetails = new Notification(
R.drawable.icon, "Click Me!", System.currentTimeMillis());
Context context = getApplicationContext();
CharSequence contentTitle = "Notification Details...";
CharSequence contentText = "Ted";
Intent notifyIntent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("http://www.android.com"));
PendingIntent intent = PendingIntent.getActivity(this, 0, notifyIntent,
android.content.Intent.FLAG_ACTIVITY_NEW_TASK);
notifyDetails.setLatestEventInfo(context, contentTitle,
contentText, intent);
mNotificationManager.notify(1, notifyDetails);
}
}
特德