The Wayback Machine - https://web.archive.org/web/20240926145946/https://www.geeksforgeeks.org/how-to-push-notification-in-android/
Open In App

How to Push Notification in Android?

Last Updated : 20 Aug, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Notification is a message which appears outside of our Application’s normal UI. A notification can appear in different formats and locations such as an icon in the status bar, a more detailed entry in the notification drawer, etc. Through the notification, we can notify users about any important updates, events of our application. By clicking the notification user can open any activity of our application or can do some action like opening any webpage etc. 

How Does Notification Look?

Let see the basic design of a notification template that appears in the navigation drawer. 

How Does Notification Look


Part of a Notification 

Method for defining contents 

Type of argument needs to pass into the method

Small IconsetSmallIcon()need to pass a drawable file as an ID that is an Int type.
App NameBy default, App Name is provided by the System and we can’t override it.
Time StampBy default, timeStamp is provided by the System but we can override it by setWhen() method.A Long type of data should be passed.
TitlesetContentTitle()A String type of data should be passed.
TextsetContentText()A String type of data should be passed.
Large IconsetLargeIcon()A Bitmap! type image file data should be passed. 

Understand Some Important Concepts of Push a Notification

We shall discuss all the concepts mentioned below step by step,

  1. Creating a basic notification
  2. Creating notification channel
  3. Adding large icon
  4. Making notification expandable
  5. Making notification clickable
  6. Adding an action button to our notification

1. Creating a basic notification 

To create a basic notification at first we need to build a notification. Now to build notification, we must use NotificationCompat.Builder() class where we need to pass a context of activity and a channel id as an argument while making an instance of the class. Please note here we are not using Notification.Builder(). NotificationCompat gives compatibility to upper versions (Android 8.0 and above) with lower versions (below Android 8.0).

Kotlin
val nBuilder = NotificationCompat.Builder(this,CHANNEL_ID)
                    .setContentTitle(et1.text.toString())
                    .setContentText(et2.text.toString())
                    .setSmallIcon(R.drawable.spp_notification_foreground)
                    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                    .build()

Please note, here we need to set the priority of the notification accordingly by the setPriority() method.

Now to deliver the notification we need an object of NotificationManagerCompat class and then we notify it.

Kotlin
val nManager = NotificationManagerCompat.from(this)
// Here we need to set an unique id for each
// notification and the notification Builder
            nManager.notify(1, nBuilder)

Please note that, in this method, we can deliver notification only in the android versions below 8.0 but in the android versions 8.0 and upper, no notification will appear by only this block of code.

2. Creating a notification channel

Now to deliver notifications on android version 8.0 and above versions, we need to create a notification channel. This  Notification Channel concept comes from android 8.0. Here every application may have multiple channels for different types of notifications and each channel has some type of notification. Before you can deliver the notification on Android 8.0 and above versions, you must register your app’s notification channel with the system by passing an instance of NotificationChannel to createNotificationChannel().

Kotlin
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            val channel = NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT).apply {
                description = CHANNEL_DESCRIPTION
            }
            val nManager: NotificationManager =
            getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
            nManager.createNotificationChannel(channel)
        }


Please note that here we must provide a unique CHANNEL_ID for each channel and also we must give a CHANNEL_NAME and CHANNEL_DESCRIPTION. Also, we must give channel importance.

3. Adding a large icon

To set a large icon we use the setLargeIcon() method which is applied to the instance of the NotificationCompat.Builder() class. In this method, we need to pass a Bitmap form of an image. Now to convert an image file (e.g. jpg, jpeg, png, etc.)  of the drawable folder into a Bitmap, we use the following code in Kotlin

Kotlin
// converting a jpeg file to Bitmap file and making an instance of Bitmap!
val imgBitmap=BitmapFactory.decodeResource(resources,R.drawable.gfg_green)

// Building notification
val nBuilder= NotificationCompat.Builder(this,CHANNEL_ID)
                    .setContentTitle(et1.text.toString())
                    .setContentText(et2.text.toString())
                    .setSmallIcon(R.drawable.spp_notification_foreground)
                    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                    // passing the Bitmap object as an argument 
                    .setLargeIcon(imgBitmap)
                    .build()

4. Making notification expandable

In the short template of the notification, large information can’t be shown. Therefore we need  to make the notification expandable like this:

imgonline-com-ua-resize-gm7SFwRck5o9ywT


to make such an expandable notification we use the setStyle() method on the notification builder (nBuilder) object. In this expanded area we can display an image, any text, different messages, etc. In our Application, we have added an image by passing the instance of the  NotificationCompat.BigPictureStyle class to setStyle() method.

imgonline-com-ua-resize-gm7SFwRck5o9ywT


Kotlin
val imgBitmap = BitmapFactory.decodeResource(resources,R.drawable.gfg_green)
val nBuilder = NotificationCompat.Builder(this,CHANNEL_ID)
                    .setContentTitle(et1.text.toString())
                    .setContentText(et2.text.toString())
                    .setSmallIcon(R.drawable.spp_notification_foreground)
                    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                    .setLargeIcon(imgBitmap)
                    // Expandable notification
                    .setStyle(NotificationCompat.BigPictureStyle()
                            .bigPicture(imgBitmap)
                            // as we pass null in bigLargeIcon() so the large icon 
                            // will goes away when the notification will be expanded.
                            .bigLargeIcon(null as Bitmap?))
                    .build()

5. Making notification clickable

We need to make our notification clickable to perform some action by clicking the notification such as open an activity or system setting or any webpage etc. Now to perform such actions intent is needed (e.g. explicit or implicit intent). In our Application, we are making an Implicit intent to open the GFG official home page.

Kotlin
// Creating the Implicit Intent to 
// open the home page of GFG   
val intent1= Intent()
        intent1.action=Intent.ACTION_VIEW
        intent1.data=Uri.parse("https://www.geeksforgeeks.org/")

Now it is not necessary that whenever the notification will appear then the user will click it instantly, user can click it whenever he /she wants and therefore we also need to make an instance of PendingIntent which basically makes the intent action pending for future purpose.

Kotlin
val pendingIntent1=PendingIntent.getActivity(this, 5, intent1, PendingIntent.FLAG_IMMUTABLE)

// Here the four parameters are context of activity,
// requestCode,Intent and flag of the pendingIntent respectively
// The request code is used to trigger a
// particular action in application activity
val nBuilder = NotificationCompat.Builder(this,CHANNEL_ID)
                    .setContentTitle(et1.text.toString())
                    .setContentText(et2.text.toString())
                    .setSmallIcon(R.drawable.notifications)
                    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                    .setLargeIcon(imgBitmap)
                    .setStyle(NotificationCompat.BigPictureStyle()
                            .bigPicture(imgBitmap)
                            .bigLargeIcon(null as Bitmap?))
                    // here we are passing the pending intent 
                    .setContentIntent(pendingIntent1)
                    // as we set auto cancel true, the notification 
                    // will disappear after afret clicking it
                    .setAutoCancel(true)
                    .build()

6. Adding an action button to our notification

Sometimes there exists some action button at our notification template that is used to perform some action.

Here we also need an Intent and a PendingIntent. Then we need to pass the instance of the PendingIntent to addAction() method at the time of building the notification.

Kotlin
// Creating the Implicit Intent 
// to open the GFG contribution page   
val intent2 = Intent()
        intent2.action = Intent.ACTION_VIEW
        intent2.data = Uri.parse("https://www.geeksforgeeks.org/contribute/")
        
val pendingIntent2= PendingIntent.getActivity(this, 6, intent2, PendingIntent.FLAG_IMMUTABLE)

val nBuilder = NotificationCompat.Builder(this,CHANNEL_ID)
                    .setContentTitle(et1.text.toString())
                    .setContentText(et2.text.toString())
                    .setSmallIcon(R.drawable.notifications)
                    .setPriority(NotificationCompat.PRIORITY_DEFAULT)
                    .setLargeIcon(imgBitmap)
                    .setStyle(NotificationCompat.BigPictureStyle()
                            .bigPicture(imgBitmap)
                            .bigLargeIcon(null as Bitmap?))
                    .setContentIntent(pendingIntent1)
                    .setAutoCancel(true)
                    // Here we need to pass 3 arguments which are 
                    // icon id, title, pendingIntent respectively
                    // Here we pass 0 as icon id which means no icon
                    .addAction(0,"LET CONTRIBUTE",pendingIntent2)
                    .build()

Example

Let discuss all the concepts by making an Application named GFG_PushNotification. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Kotlin language. 

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Kotlin as the programming language. Choose the API level according to your choice( Here we have chosen API Level 26).

After creating the project successfully, please paste some pictures into the drawable folder in the res directory. Now you can use the same pictures which I have used in my project otherwise you can choose pictures of your own choice. To download the same pictures please click on the below-given link:

CLICK HERE

***Please note that it is optional***

Step 2: Adding Permission for notification

Android 13 (API level 33) and higher need a permission for posting notifications from an app. For this, declare permission in the manifest file. Please manually make sure that the permission for notifications is provided for this app on phone.

XML
<manifest ...>
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
    <application ...>
        ...
    </application>
</manifest>


Step 3: Working with the activity_main.xml file

Go to the activity_main.xml file and refer to the following code. Below is the code for the activity_main.xml file.

XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <ImageView
        android:id="@+id/imgGFG"
        android:layout_width="200dp"
        android:layout_height="200dp"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="70dp"
        android:src="@drawable/gfg_white" />

    <!-- EditText for entering the title-->
    <EditText
        android:id="@+id/et1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/imgGFG"
        android:layout_marginLeft="30dp"
        android:layout_marginRight="30dp"
        android:background="#d7ffd9"
        android:hint="Enter The Title"
        android:padding="10dp"
        android:textSize="20sp"
        android:textStyle="bold" />

    <!-- EditText for entering the text-->
    <EditText
        android:id="@+id/et2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/et1"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="30dp"
        android:layout_marginRight="30dp"
        android:background="#d7ffd9"
        android:hint="Enter The Text"
        android:padding="10dp"
        android:textSize="20sp"
        android:textStyle="bold" />

    <!-- Button for sending notification-->
    <Button
        android:id="@+id/btn1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/et2"
        android:layout_marginLeft="30dp"
        android:layout_marginTop="30dp"
        android:layout_marginRight="30dp"
        android:background="#0F9D58"
        android:text="send notification"
        android:textColor="#000000"
        android:textSize="20sp"
        android:textStyle="bold" />

</RelativeLayout>
APPLICATION UI DESIGN

Step 4: Insert a vector asset into the drawable folder in the res directory

Right-click on the drawable folder → NewVector Asset → select appropriate Clip Art → give appropriate Name and adjust Size accordingly→ Next then click on the finish button as shown in the below image.

Image

Step 5: Working with the MainActivity.kt file

Go to the MainActivity.kt file and refer to the following code. Below is the code for the MainActivity.kt file. Comments are added inside the code to understand the code in more detail.

Kotlin
package com.example.gfg_pushnotification

import android.Manifest
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.content.pm.PackageManager
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat


class MainActivity : AppCompatActivity() {
    val CHANNEL_ID = "GFG"
    val CHANNEL_NAME = "GFG ContentWriting"
    val CHANNEL_DESCRIPTION = "GFG NOTIFICATION"

    // the String form of link for
    // opening the GFG home-page
    val link1 = "https://www.geeksforgeeks.org/"

    // the String form of link for opening
    // the GFG contribution-page
    val link2 = "https://www.geeksforgeeks.org/contribute/"
    lateinit var et1: EditText
    lateinit var et2: EditText
    lateinit var btn1: Button
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // Binding Views by their IDs
        et1 = findViewById(R.id.et1)
        et2 = findViewById(R.id.et2)
        btn1 = findViewById(R.id.btn1)
        btn1.setOnClickListener {

            // Converting the .png Image file to a Bitmap!
            val imgBitmap = BitmapFactory.decodeResource(resources, R.drawable.gfg_green)

            // Making intent1 to open the GFG home page
            val intent1 = gfgOpenerIntent(link1)

            // Making intent2 to open The GFG contribution page
            val intent2 = gfgOpenerIntent(link2)

            // Making pendingIntent1 to open the GFG home
            // page after clicking the Notification
            val pendingIntent1 = PendingIntent.getActivity(this, 5, intent1, PendingIntent.FLAG_IMMUTABLE)

            // Making pendingIntent2 to open the GFG contribution
            // page after clicking the actionButton of the notification
            val pendingIntent2 = PendingIntent.getActivity(this, 6, intent2, PendingIntent.FLAG_IMMUTABLE)

            // By invoking the notificationChannel() function we
            // are registering our channel to the System
            notificationChannel()

            // Building the notification
            val nBuilder = NotificationCompat.Builder(this, CHANNEL_ID)

                // adding notification Title
                .setContentTitle(et1.text.toString())

                // adding notification Text
                .setContentText(et2.text.toString())

                // adding notification SmallIcon
                .setSmallIcon(R.drawable.ic_android_black_24dp)

                // adding notification Priority
                .setPriority(NotificationCompat.PRIORITY_DEFAULT)

                // making the notification clickable
                .setContentIntent(pendingIntent1)
                .setAutoCancel(true)

                // adding action button
                .addAction(0, "LET CONTRIBUTE", pendingIntent2)

                // adding largeIcon
                .setLargeIcon(imgBitmap)

                // making notification Expandable
                .setStyle(NotificationCompat.BigPictureStyle()
                    .bigPicture(imgBitmap)
                    .bigLargeIcon(null as Bitmap?))
                .build()

            // finally notifying the notification
            val nManager = NotificationManagerCompat.from(this)

            // Check if the permission for POST_NOTIFICATION is provided or not
            if (ActivityCompat.checkSelfPermission(
                    this,
                    Manifest.permission.POST_NOTIFICATIONS
                ) != PackageManager.PERMISSION_GRANTED){

                return@setOnClickListener
            }
            nManager.notify(1, nBuilder)


        }
    }

    // Creating the notification channel
    private fun notificationChannel() {
        // check if the version is equal or greater
        // than android oreo version
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            // creating notification channel and setting
            // the description of the channel
            val channel = NotificationChannel(CHANNEL_ID, CHANNEL_NAME, NotificationManager.IMPORTANCE_DEFAULT).apply {
                description = CHANNEL_DESCRIPTION
            }
            // registering the channel to the System
            val notificationManager: NotificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
            notificationManager.createNotificationChannel(channel)
        }
    }

    // The function gfgOpenerIntent() returns
    // an Implicit Intent to open a webpage
    private fun gfgOpenerIntent(link: String): Intent {
        val intent = Intent()
        intent.action = Intent.ACTION_VIEW
        intent.data = Uri.parse(link)
        return intent
    }
}

Output:



Similar Reads

How to Push Notification in Android using Firebase In-App Messaging?
We have seen using Firebase push notifications in Android which is used to send push notifications to our users when our user is online. These notifications are being displayed inside the notifications tab in the top section of our phone. In this article, we will take a look at the implementation of Firebase In-App Messaging to display messages to
6 min read
How to Increase Push Notification Delivery Rate in Android?
Notifications are an essential component of any application. Almost every application on your mobile device will send some kind of notification. The WhatsApp notification is one of the best examples of this. Whenever you receive a message, it is displayed on your phone in the form of notifications. However, many developers find it difficult to send
8 min read
How to Push Notification in Android using Firebase Cloud Messaging?
Firebase Cloud Messaging is a real-time solution for sending notifications to client apps without any kind of charges. FCM can reliably transfer notifications of up to 4Kb of payload. In this article, a sample app showing how this service can be availed is developed. Though FCM also allows sending out notifications using an app server, here Firebas
9 min read
Push Notifications in Android Using OneSignal
We have seen so many types of notifications that we received in many of the Android apps. These notifications inform our users about the new offers, new features, and many more inside our application. In this article, we will take a look at the implementation of the OneSignal notification platform in the Android app in Android Studio. We will be bu
6 min read
Create an Expandable Notification Containing Some Text in Android
Notification is a type of message that is generated by any application present inside the mobile phone, suggesting to check the application and this could be anything from an update (Low priority notification) to something that's not going right in the application (High priority notification). A basic notification consists of a title, a line of tex
4 min read
Create an Expandable Notification Containing a Picture in Android
Notification is a type of message that is generated by any application present inside the mobile phone, suggesting to check the application and this could be anything from an update (Low priority notification) to something that's not going right in the application (High priority notification). A basic notification consists of a title, a line of tex
4 min read
How to Implement Notification Counter in Android?
Notification Counter basically counts the notifications that you got through an application and shows on the top of your application icon so that you get to know you get new messages or any new update without opening your application or specific feature like the message button in Instagram. Notification counter is a feature that is provided in almo
7 min read
How to Disable Notification in Android Studio?
Android Studio is the official IDE (Integrated Development Environment) for Android app development and it is based on JetBrains’ IntelliJ IDEA software. Android Studio provides many excellent features that enhance productivity when building Android apps, such as: A blended environment where one can develop for all Android devicesApply Changes to p
1 min read
How to Enable Notification Runtime Permission in Android 13?
Android 13 starts a new realm of new app permissions which are focussed on users' privacy and peace of mind, one of which is the permission to send notifications to the user. Notifications are an integral part of the Android Operating System, but when you have tons of apps installed, then receiving notifications from them starts getting worse. Star
5 min read
Notification Manager in Android
Firstly, let's understand what notifications are on Android. Notifications are short, timely messages that inform the user about events that occur within an app. They are a crucial component of the user experience on an Android device, as they provide users with important information and help them stay informed about what's happening in their apps.
5 min read
Flutter - Schedule Local Notification using Timezone
In this article, we will explore the process of scheduling local notifications using the Timezone package in Flutter. Local Notification:Flutter Local Notification is a cross-platform plugin used to show notifications in the Flutter application. These notifications can be simple, scheduled, or periodical and these notifications can have custom soun
6 min read
Android Manifest File in Android
Every project in Android includes a Manifest XML file, which is AndroidManifest.xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements. This file includes nodes for each of the Activities, Se
5 min read
Android | Android Application File Structure
It is very important to know about the basics of Android Studio's file structure. In this article, some important files/folders, and their significance is explained for the easy understanding of the Android studio work environment. In the below image, several important files are marked: All of the files marked in the above image are explained below
3 min read
What's Android Interface Definition Language (AIDL) in Android?
The Android Interface Definition Language (AIDL) is analogous to other IDLs you would possibly have worked with. It allows you to define the programming interface that both the client and repair agree upon so as to speak with one another using interprocess communication (IPC). Traditionally the Android way a process cannot access the memory of some
7 min read
Android | Running your first Android app
After successfully Setting up an Android project, all of the default files are created with default code in them. Let us look at this default code and files and try to run the default app created. The panel on the left side of the android studio window has all the files that the app includes. Under the java folder, observe the first folder containi
3 min read
How to Clone Android Project from GitHub in Android Studio?
Android Studio provides a platform where one can build apps for Android phones, tablets, Android Wear, Android TV, and Android Auto. Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. One can develop Android Applications using Kotlin or Java as the Backend Language, and it provides XML for developing Fro
3 min read
How to Add OpenCV library into Android Application using Android Studio?
OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. When it integrated with various libraries,
3 min read
8 Best Android Libraries That Every Android Developer Should Know
Android is an operating system which is built basically for Mobile phones. It is used for touchscreen mobile devices like smartphones and tablets. But nowadays these are utilized in Android Auto cars, TV, watches, camera, etc. Android has been one of the best-selling OS for smartphones. Android OS was developed by Android Inc. which Google bought i
5 min read
How to Add Audio Files to Android App in Android Studio?
The audio file format is a file format for saving digital audio data on a computer system and all are aware of audio files. So in this article, we are going to discuss how can we add audio files to the android app. There are three major groups of audio file formats: Format Name Description Examples Uncompressed audio formatsUncompressed audio forma
3 min read
Different Ways to Change Android SDK Path in Android Studio
Android SDK is one of the most useful components which is required to develop Android Applications. Android SDK is also referred to as the Android Software Development Kit which provides so many features which are required in Android which are given below: A sample source code.An Emulator.Debugger.Required set of libraries.Required APIs for Android
5 min read
How to Capture a Screenshot and Screen Recording of an Android Device Using Android Studio?
Android Studio is the official IDE (Integrated Development Environment) for Android app development and it is based on JetBrains’ IntelliJ IDEA software. Android Studio provides many excellent features that enhance productivity when building Android apps. Whenever we are developing an app and in that device, you don't know how to capture screenshot
2 min read
Different Ways to Fix “Select Android SDK” Error in Android Studio
Android SDK is one of the most useful components which is required to develop Android Applications. Android SDK is also referred to as the Android Software Development Kit which provides so many features which are required in Android which are given below: A sample source code.An Emulator.Debugger.Required set of libraries.Required APIs for Android
5 min read
Different Ways to Analyze APK Size of an Android App in Android Studio
APK size is one of the most important when we are uploading our app to Google Play. APK size must be considered to be as small as possible so users can visit our app and download our app without wasting so much data. In this article, we will take a look at How we can analyze our APK in Android Studio to check the APK size. Android Studio itself pro
3 min read
Different Ways to fix "Error running android: Gradle project sync failed" in Android Studio
Gradle is one of the most important components of Android apps. It handles all the backend tasks and manages all the external dependencies which we will be going to use in building our Android Application. Sometimes due to any issue or after formatting of your pc. Some of the Gradle files may get deleted unexpectedly. So when you will start buildin
3 min read
How to Fix “Failed to install the following Android SDK packages as some licenses have not been accepted” Error in Android Studio?
When you download the latest Android SDK tools version using the command line to install SDKs and you just try to build gradle then this error shows up: Failed to install the following Android SDK packages as some licenses have not been accepted. platforms;android-27 Android SDK Platform 27 build-tools;27.0.3 Android SDK Build-Tools 27.0.3 To build
4 min read
How to fix "Android Studio doesn't see device" in Android Studio?
In Android Studio, sometimes the list of devices and emulators doesn't list your physical device when you try to plug it in. Or you may have faced a situation when you plugged the phone in for the first time, no dialog appeared asking if you trust the computer. But the laptop is already allowed to connect to the mobile device. However, the button R
4 min read
How to Fix "Android studio logcat nothing to show" in Android Studio?
Logcat Window is the place where various messages can be printed when an application runs. Suppose, you are running your application and the program crashes, unfortunately. Then, Logcat Window is going to help you to debug the output by collecting and viewing all the messages that your emulator throws. So, this is a very useful component for the ap
2 min read
How to Build a Number Shapes Android App in Android Studio?
Android is a vast field to learn and explore and to make this learning journey more interesting and productive we should keep trying new problems with new logic. So, today we are going to develop an application in android studio which tells us about Numbers that have shapes. We will be covering two types of numbers i.e. triangular and square. So, f
4 min read
How to Fix "android.os.Network On Main Thread Exception error" in Android Studio?
The main reason for Network On Main Thread Exception Error is because the newer versions of android are very strict against the UI thread abuse. Whenever we open an app, a new “main” thread is created which helps applications interact with the running components of an app’s UI and is responsible for dispatching events to assigned widgets. The entir
3 min read
10 Android Studio Tips and Tricks For Android Developers
To become a good Android developer you should be familiar with Android Studio with some of its tips and tricks. These tips and tricks will help you to become a good Android developer and it will also help you to improve your efficiency in developing Android Apps. In this article, we will be discussing 10 Android Studio, Tips, Tricks, and Resources
6 min read