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);
}
}
特德