The Wayback Machine - https://web.archive.org/web/20241125105551/https://www.geeksforgeeks.org/how-to-add-image-to-drawable-folder-in-android-studio/
Open In App

How to Add Image to Drawable Folder in Android Studio?

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

The resource folder is the most important folder because it contains all the non-code sources like images, XML layouts, UI strings for the android application. In Android Studio inside the res folder, one can find the drawable folder, layout folder, mipmap folder, values folder, etc. Among them, the drawable folder contains the different types of images used for the development of the application. We need to add all the images to the drawable folder for the application development. Images are used in android applications to provide more user-friendly behavior & functionality. So in this article, we are going to discuss how to add an image to the drawable folder with multiple methods being explained step by step.

Method 1

In method 1 we will do it through the way Android Studio provided to you.

Step 1: Open Android Studio and go to the app > res > right-click > New > Image Asset as shown in the below figure.

Step 2: A pop-up screen will arise like below. Here choose Action Bar and Tab Icons in Icon Type.

Step 3: Then choose Asset Type as Image and enter the Path of your image. Enter the name of your image and click on Next.  

Step 4: Now you can see the android studio automatically created the different-sized images. You can directly create the folder and drag image inside but you won’t have the different-sized icons if you do that and this the main advantage of following this method. And finally, click on the Finish button.

Now go to the app > res > drawable and you can find a folder named as image and the different sized images inside this folder as shown in the below image.

Note: 

  • drawable-ldpi (low-density): Lower images quality supported by the earlier sets of the android – 240×320 pixels
  • drawable-mdpi (medium-density): For medium images support – 320×480 pixels
  • drawable-hdpi (high-density): Images for the Android Broad Screen set or Android Phones with the Higher resolution – 480×800 pixels
  • drawable-xhdpi (extra high-density): Devices with maximum resolution – 720×1280 pixels

Adding images to the drawable folder is a basic task, but managing them efficiently is key to smooth app development. To learn advanced techniques for handling resources in Kotlin-based Android apps, the Android Mastery with Kotlin: Beginner to Advanced course provides practical examples.

Method 2

Method 2 is very easy but as we discussed above we can directly create the folder and drag image inside but you won’t have the different-sized icons if you do that and this the main advantage of method 1. So the developer must follow method 1. Below is the step by step implementation of method 2:

Step 1: In this method first of all in your system find your required images and copy the image as we do normally.

Step 2: Then open the Android Studio go to the app > res > drawable > right-click > Paste as shown in the below figure.

Step 3: Then a pop-up screen will arise like below. Here choose your directory where you want to store your image file. And click on OK.

Step 4: In this screen, you can rename your image file name and also choose your directory. And click on the Refactor button. And you are done.

Now go to the app > res > drawable and you can find a file named as method_2.jpg as shown in the below image.



Previous Article
Next Article

Similar Reads

How to Convert SVG, PSD Images to Vector Drawable File in Android Studio?
In order to use the SVG (Scalable Vector Graphics) or PSD (Photoshop document) image file in your android studio project, you have to first convert them into an XML (Vector Drawable) file. Why XML (Vector Drawable) file? small in sizescalability (It scaled without loss of display quality)height and width can be changed easilysupport transparencycol
3 min read
How to Create Drawable Resource XML File in Android Studio?
Prerequisite: Android Project folder Structure A drawable resource is a common concept for a graphic that can be drawn to the screen and which one can retrieve with APIs such as getDrawable(int) or apply to another XML resource with attributes such as android:drawable and android:icon. There are several different types of drawable resources files a
3 min read
How to Add Text Drawable to ImageView in Android?
In many android apps, you will get to see a feature in which you can see a simple text is displayed inside an ImageView or you can get to see that a text is displayed in a specific image or a shape. Mostly this type of view is seen in the Contacts application which is present on your Android device. In that app, you will get to see the first letter
5 min read
How to Display a Drawable Inside a Button in Android?
A Button in Android is basically a subclass of TextView, which lets the user press or click it to perform an action. Buttons generally contain text that lets the user understand the action property of the button. Sometimes, an ImageView can also be used as a button if the developer wishes to display an image rather than some text. But some buttons
3 min read
How to Convert Drawable to Bitmap in Android using Jetpack Compose?
A drawable is an image file that is used to display inside our image view. We can display the images directly within the image view from our drawable folder. Images can be displayed within our image view directly in the form of the image file or a bitmap format. In this article, we will take a look at How to Convert Drawable to Bitmap in Android us
7 min read
How to Set Background Drawable Programmatically in Android?
In many android applications, we can get to see that the background color of this application changes dynamically when updated from the server. For updating this color we have to set the background color of our layout programmatically. In this article, we will take a look at How to Set Background Drawable Programmatically in an Android application.
3 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 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 Create Anim Folder & Animation File in Android Studio?
The animation is a method in which a collection of images is combined in a specific way and processed then they appear as moving images. Building animations make on-screen objects seem to be alive. To apply Animations to the Application sometimes we need to make an anim folder in Android Studio to store the animation file under the resource folder
2 min read
How to Create New Package Inside Src Folder in Android Studio?
A package is a namespace that combines a set of relevant classes and interfaces. Conceptually one can consider packages as being similar to various folders on your computer. One might have HTML pages in one folder, images in another, and scripts or applications in yet another. Because in android, software written in the Java/Kotlin programming lang
2 min read
Resource Raw Folder in Android Studio
The raw (res/raw) folder is one of the most important folders and it plays a very important role during the development of android projects in android studio. The raw folder in Android is used to keep mp3, mp4, sfb files, etc. The raw folder is created inside the res folder: main/res/raw. So we will simply create it inside the res folder. But befor
4 min read
How to Create Menu Folder & Menu File in Android Studio?
Menus are the common user interface component in almost all the application. This interface provides a few options from which the user can select an option. There are 3 types of menu types available in Android: Options menu and app barContext menu and contextual action modePopup menuHow to define Menu in XML? In android, we can build the menu on ou
3 min read
Assets Folder in Android Studio
It can be noticed that unlike Eclipse ADT (App Development Tools), Android Studio doesn’t contain an Assets folder in which we usually use to keep the web files like HTML. Assets provide a way to add arbitrary files like text, XML, HTML, fonts, music, and video in the application. If one tries to add these files as "resources", Android will treat t
4 min read
How to Get Image from Image Asset in Android Studio?
While Developing an App, we require many images as an icon in our app. Here we are going to explain how we can get image in Android Studio using Image Asset. Creating an attractive launcher icon for your app, that the user will first come across while looking at your app, anyway needs more brainstorming. For Android, you need to create these graphi
1 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
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
How to Add Resource File in Existing Android Project in Android Studio?
Android resource file is a file that stores resources needed for the UI part of an android application. Like: Layout files, drawable files, etc. In the android application, it is very often that we need another resource file for another purpose in the existing application. There are many types of resource files Layout files, Drawables, Menus are so
1 min read
How to Add Firebase Analytics to Android App in Android Studio?
Analytics is one of the important tools that developers should definitely used while building their applications. It is very helpful to target your apps for various audience ranges and to track on which screen the users are spending a long time. So it is one of the important features which one should not miss adding while building any Android Appli
4 min read
How to Add Local HTML File in Android Studio?
HTML stands for HyperText Markup Language. It is used to design web pages using a markup language. HTML is the combination of Hypertext and Markup language. Hypertext defines the link between the web pages. A markup language is used to define the text document within the tag which defines the structure of web pages. HTML is a markup language that i
3 min read
How to Add Different Resolution Images in Android Studio?
Android supports a broad range of devices and if one wants to create an application in android then the application must be compatible with the different mobile devices. For supporting the different screen sizes one must have different size images that will save in multiple folders. Normally Android has four folders that cover almost every device:
2 min read
Different Ways to Change or Add Themes to Android Studio
When we are working on any editor or IDE we get used to it and its environment like if we are using Sublime then we like its dark background environment. We have now moved to Android studio but we are not comfortable with the default background and theme. Now the point that comes here is how we can Change or Add Themes to Android Studio. So in this
3 min read
How to Add a Library Project to Android Studio?
Adding an external library in Android Studio is a very common thing but still, most beginners or freshers find it difficult to do. Some of you must have gone through this. Whenever you want to add some external library and you try to do that with maven(File > Project Structure > Dependencies) and try to add your dependencies there but when yo
4 min read
How to Add Vector Assets in Android Studio?
Vector Assets in Android Studio helps to add material icons and import Scalable Vector Graphics and Adobe Photoshop Document files into your project as vector drawable resources. How Vector Asset is different from Image Asset? Image Asset Studio helps us create different types of icons with different densities and shows us exactly where they'll be
3 min read
How to Add External Library 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. In this article, we will learn how to add external libraries to our android project. Method 1:
2 min read
Different Ways to Add Stacktrace or debug Option when Building Android Studio Project
While developing your favorite app, you might at some point of time arrived upon this strange error, :GfGapp:processDebugResources FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to
2 min read
How to Add Support Library to Android Studio Project?
An android support library is part of Android SDK tools. You can use the Android Support Library for backward-compatible versions of new Android features and additional UI elements and features not included in the standard Android framework. Each package in the support library has a version number in three parts (X.Y.Z) that correspond to an Androi
3 min read
How to Install Genymotion Emulator and Add it’s Plugin to Android Studio?
If you're an Android developer looking for a powerful and efficient emulator, installing the Genymotion emulator might be the perfect solution for you. Known for its speed and reliability, the Genymotion emulator for Android development offers a seamless experience. In this guide, we'll walk you through the steps to install the Genymotion emulator
5 min read
How to Reduce and Compress Image Size 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. Here, we are going to reduce and compress any image using the Android Studio. Step By Step Imp
1 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
Article Tags :
three90RightbarBannerImg