The Startup
Published in

The Startup

Android Notifications | Notification Channel | Big Picture Style | Android Studio

Android Notifications | Notification channel | Big Picture Style | Android Studio

In this tutorial, we’re going to see how to send text and image notifications on android. Before going to create it, first see what notification is?

What is Android Notification?

A notification is a message that Android displays outside your app’s UI to provide the user with reminders, communication from other people, or other timely information from your app. Users can tap the notification to open your app or take an action directly from the notification.

For more Click Here.

Now let’s see how to create it.

Step 1: Design Main XML

In the main XML file create a hook from where we will call our notification channel to show the notification. Here I use a Button to invoke a notification channel.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android=""
app:layout_constraintStart_toStartOf="parent" />

Step 2: Add Functionality

  • Set the OnClickListener on the button that we created to invoke the notification channel.
findViewById( View.OnClickListener() {
public void onClick(View view) {
showNotification(); // for notification with Text
  • now create showNotification() function in the class. This function is for notification with text.
//text Notification
private void showNotification(Bitmap bitmap) {

  • create a notification channel and set the notification title, text etc.
//text Notification
private void showNotification(Bitmap bitmap) {
int noificationId = new Random().nextInt(100);
String channelId = "notification_channel_3";
NotificationManager notificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Intent intent = new Intent(getApplicationContext(), SecondActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(),
NotificationCompat.Builder builder = new NotificationCompat.Builder(
getApplicationContext(), channelId
builder.setContentTitle("Notification 3"); // make suer change the channel for image
builder.setContentText("Lorem Ipsum is simply dummy text of the printing and typesetting industry");
//notification for image
builder.setStyle(new NotificationCompat.BigPictureStyle().
if (notificationManager != null && notificationManager.
getNotificationChannel(channelId) == null){
NotificationChannel notificationChannel = new NotificationChannel(
channelId, "Notification channel 1",
notificationChannel.setDescription("This notification channel is used to notify user");
Notification notification =;
if (notificationManager != null){
notificationManager.notify(noificationId, notification);
  • now create a function for notification with image, here I named it as showNotificationWithImage().
//notification with image
private void showNotificationWithImage(){

  • add the functionality for the image notification, also don’t forget to initialize the bitmap in the showNotification() function, because this the main function which creates the notification for us.
//notification with image
private void showNotificationWithImage(){
new AsyncTask<String, Void, Bitmap>(){
protected Bitmap doInBackground(String... strings) {
InputStream inputStream;
try {
URL url = new URL(strings[0]);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
inputStream = connection.getInputStream();
return BitmapFactory.decodeStream(inputStream);
}catch (Exception ignored){ }
return null;
protected void onPostExecute(Bitmap bitmap) {

Output (Notification with text)

Output (Notification with Image)

Want to watch how to create it, visit my YouTube channel and watch it:

YouTube: Click Here

You can also follow me on Instagram and Facebook

Instagram: Android App Developer
Facebook: GBAndroidBlogs




Get smarter at building your thing. Follow to join The Startup’s +8 million monthly readers & +756K followers.

Recommended from Medium

Android’s Media Scanner: How do I remove files?

Firebase Phone number authentication in Android | Android Studio | Java

Migrating From RxKotlin to Kotlin Coroutines

repeatOnLifecycle API design story

HMS Accountkit :There are up to one billion HUAWEI ID users across the globe.

Android Animation | Day and Night Mode | Dark and Night Switch

Android 102 : Why does dagger generate MembersInjector for us?

Android Stack Weekly — Issue #15

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Golap Gunjan Barman

Golap Gunjan Barman

Hi everyone, myself Golap an Android app developer with UI/UX designer.

More from Medium

Exploring Photo Picker in Android 13

Monitoring Network Bandwidth Usage in the Doubtnut app.

Find the introduction Sliders and Huawei Account Kit Integration in Money Management Android app…

Meet DataStore — The New SharedPreferences for Android