2

What is the path of drawable folder in android studi0 ?

In android studio , the directory structure is

 MyApp
     |
     .idea
     |
      assets 
     |
      gen
     |
      res
     |    |
     |     drawable
      src
     |    |
     |      com.example.mobile
     |    |                  |
     |    |                    activity
     |    |                     utils
     |     AndroidManifest.xml
     |
      ExternalLibraries
ouflak
  • 2,458
  • 10
  • 44
  • 49
vijay
  • 2,034
  • 3
  • 19
  • 38
  • 1
    is it not under res ? – Vamsi Pavan Mahesh Jul 17 '13 at 14:56
  • @vamsi yeah it is under res folder. – vijay Jul 17 '13 at 14:57
  • can u eloborate ur problem ? what exactly is the question – Vamsi Pavan Mahesh Jul 17 '13 at 14:59
  • It sounds like you found it. Problem solved? – Bryan Herbst Jul 17 '13 at 14:59
  • @Tanis.7x I need to delete a particular image from drawable folder in onCreate method called in my activity. Therefore , I need the pathname of the drawable folder so that I could delete that particular image on using some File operations. – vijay Jul 17 '13 at 15:03
  • In that case, Android Studio is completely irrelevant. You are looking for the path to the files on the device, not on your computer. Secondly, everything in your APK is read-only. As Vamsi states below, you will need another solution, such as temporarily storing the image on the device's internal/external storage. – Bryan Herbst Jul 17 '13 at 15:06
  • @Tanis.7x actually I have two builds(say build a and build b) of the same application. Respective images are saved in drawable folder (e.g. logo_a.png ,logo_b.png).Now when I install build a ,then I don't need images for build b.Thus , I want it be deleted while build a is being installed. Is not that possible ? – vijay Jul 17 '13 at 15:09
  • No. APKs (which include all everything in the res folder) are read-only. You cannot add, remove, or edit any files that come with your APK. However, if both builds have the same package name, the second APK will overwrite the first and you don't need to worry about deleting extra resources. – Bryan Herbst Jul 17 '13 at 15:16
  • @Tanis.7x can you please provide me the path to drawable folder ? And in android studio , everything isnot under res folder. Though drawable is under res folder.Please have a look at the directory structure I have provided. – vijay Jul 17 '13 at 15:21
  • 1
    I'm really not sure what else to tell you, so I'm just going to leave with this: You cannot get the path to drawables in your application; [you can only get Drawables through a Resources object](http://stackoverflow.com/questions/6301493/android-get-path-of-resource). You also cannot create, edit, or remove Drawables in your application. – Bryan Herbst Jul 17 '13 at 15:28

3 Answers3

1

This is the path of drawables

app\src\main\res\
Vipin Sharma
  • 594
  • 5
  • 19
0

You may want to go to your workspace , then >> app >>res >> drawablexxxx , you can delete the image here

Vamsi Pavan Mahesh
  • 240
  • 1
  • 8
  • 30
  • I want to delete image file from the drawable folder. Is not that possible ? – vijay Jul 17 '13 at 15:04
  • check now , if it is of any help ? – Vamsi Pavan Mahesh Jul 17 '13 at 15:10
  • I want the image to be deleted only when onCreate method of particular activity is called.(not manually ) – vijay Jul 17 '13 at 15:11
  • dude , i could not get what you are asking – Vamsi Pavan Mahesh Jul 17 '13 at 15:12
  • Please look at my comments above. Hopefully you will get it. Actually,I have two images logo_a.png and logo_b.png for two builds a and b respectively in the drawable folder. Now ,when build a is run,I need logo_b.png to be deleted.For that , I have implemented File operations.Here ,it requires the path for drawable folder which I amnot able to determine,thus ,giving NullPointerException. – vijay Jul 17 '13 at 15:24
  • you want might want to do that , based on what activity you are starting ,get that image in the image view ,if i get your problem correct – Vamsi Pavan Mahesh Jul 17 '13 at 15:26
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/33642/discussion-between-vamsi-and-vijay) – Vamsi Pavan Mahesh Jul 17 '13 at 15:29
  • I am able to get the image as per the build.I just want unused images to be deleted to save memory . There are lots of images which I need to delete along with some other files. I would do the same as I would do for drawable folder for others as well. – vijay Jul 17 '13 at 15:30
0

In the project panel you can right click any file or folder and hit "Copy Path..." for various paths of the file/folder.

dot_cr2
  • 69
  • 1
  • 5