see the designing part in video:
after watching the designing part
1. declare the button as: Button _btnnotify
2. initialize the button as: _btnnotify=(Buttion)findViewByID(R.id.btnnotify).
3. Create the listening event of button and write the following code inside the listening event of button as:
after watching the designing part
1. declare the button as: Button _btnnotify
2. initialize the button as: _btnnotify=(Buttion)findViewByID(R.id.btnnotify).
3. Create the listening event of button and write the following code inside the listening event of button as:
_btnnotify.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
NotificationCompat.Builder builer = new NotificationCompat.Builder(MainActivity.this);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://techsupportnep.blogspot.com"));
PendingIntent pendingIntent = PendingIntent.getActivity(MainActivity.this, 01, intent,0);
builer.setContentIntent(pendingIntent);
builer.setDefaults(Notification.DEFAULT_ALL);
builer.setContentTitle("NOTIFICATION TILE HERE");
builer.setSmallIcon(R.mipmap.ic_launcher);
builer.setContentText("this is notification example");
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(001, builer.build());
}
});
Video:
No comments:
Post a Comment