安卓通知栏

Intent intent=new Intent(this,NotificationActivity.class);

PendingIntent pi=PendingIntent.getActivity(this,0,intent,0);

NotificationManager manager=(NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Notification notification=new NotificationCompat.Builder(this).

setContentTitle("通知标题").setContentText("内容").

setWhen(System.currentTimeMillis()).

setSmallIcon(R.drawable.ic_launcher).

setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher)).

setContentIntent(pi).

setAutoCancel(true).build();

manager.notify(1,notification);

待续

你可能感兴趣的:(安卓通知栏)