我試圖在通知欄中按通知時打開片段。我的應用程序的結構是:如何在android中按下通知時打開片段頁面
- 與導航抽屜菜單
一些片段被從菜單中打開一個基地活動
b.setOnClickListener(new OnClickListener() { @SuppressWarnings({ "deprecation", "static-access" }) public void onClick(View v) { w_nm=(NotificationManager) getActivity().getSystemService(getActivity().NOTIFICATION_SERVICE); Notification notify=new Notification(R.drawable.notnificationlogo,waternoti,System.currentTimeMillis()); Intent notificationIntent = new Intent(getActivity(), Abc.class); PendingIntent pending=PendingIntent.getActivity(getActivity(), 0,notificationIntent, 0); notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); notify.flags = Notification.DEFAULT_LIGHTS | Notification.FLAG_AUTO_CANCEL; notify.setLatestEventInfo(getActivity(),waternoti,waternoti1, pending); w_nm.notify(0, notify);
誰能告訴我如何與一個片段鏈接頁面(現在的代碼在擴展片段的類中)
Broadcast Receiever? http://developer.android.com/reference/android/content/BroadcastReceiver.html – James 2014-10-28 12:43:29
你能否詳細說明一下,我是新手機android – 2014-10-28 12:47:00