これはすべて、最初のアクティビティからタスクを完了した後に呼び出している通知クラスのコードです。
しかし、現在のアプリケーションで通知を受け取るという問題が発生しています。
通知をダイアログボックスとして表示したい。
"R.layout.main"
[OK] ボタンのあるダイアログ ボックスが含まれています。
public class Notif extends Activity implements View.OnClickListener {
private Button Button01;
private NotificationManager mManager;
private static final int APP_ID = 0;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
this.Button01 = (Button) this.findViewById( R.id.Button1);
this.Button01.setOnClickListener(this);
mManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
}
@Override
public void onClick(View v) {
Intent intent = new Intent(this,Notif.class);
Notification notification = new Notification(R.drawable.icon,
"Notify", System.currentTimeMillis());
notification.setLatestEventInfo(Notif.this,"App Name","Description of the notification",PendingIntent.getActivity(this.getBaseContext(), 0, intent,
PendingIntent.FLAG_CANCEL_CURRENT));
mManager.notify(APP_ID, notification);
}
}