How to change application launcher icon in Android

In this android programming source code example, we are going to change application launcher icon in Android.

You can copy and adopt this source code example to your android project without reinventing the wheel.

Below is a step by step source code to change application launcher icon in Android

  1. Go to AndroidManifest.xml
  2. In the tag, look for android:icon tag.
  3. Copy and paste your icon in drawable folder or mipmap folder(available in res folder of your project).
  4. Set the value of android:icon tag as android:icon=”@drawable/your_icon_name”

Then copy and paste the below code to your android project then run the project…

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DeviceFeatures.DeviceFeaturesActivity8">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Change Launcher Icon"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.java

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.bluapp.androidview2.R;

public class DeviceFeaturesActivity8 extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_device_features8);
    }
}

If you have any question or suggestions kindly use the comment box or you can contact us directly through our contact page below.

Add a Comment