1

I am building a small android app where there will be three buttons depicting individual functionality and set of images associated to these functions respectively.

When I receive these images, depending upon their functionality I will be pasting in either folder a or folder b and folder c.

As soon as the button is clicked, the onClick method in setOnClickListener class will point to the respective folder and browse through the images through the seek bar.

For example, if button A is clicked, it will point to the folder A. A seek bar will be used to browse through the images in folder A if button B is clicked, it will point to the folder B. The same seek bar will be used to browse through the images in folder B if button C is clicked, it will point to the folder C. The same seek bar will be used to browse through the images in folder C

Problem I have is I am not able to create folders under drawable. Even though creating of folders allowed, programmatically I am not able to connect to these folders and these are not visible.

I tried to create folders under app in build.gradle for module app as below

sourceSets {
        main.res.srcDirs = ['src/main/res', 'src/main/resa', 'src/main/resa/opta', 'src/main/resa/optb', 'src/main/resa/optc']
}

The above is not working. What I need is a place where I can create three folders and past the images and programmatically point to these folders.

Please can someone advise? I am using android studio. Java programming language

DBHari
  • 63
  • 6

1 Answers1

0

Why not use external storage and create folders there. You can store and access the files in those folders without any issue.

But if you must use drawled folders (avoid doing it)

How to access res/drawable/"folder"

This might solve your issue. Android doesn’t allow folders under drawables. But you can create a naming structure like folder_a_file_1 and divide the files while displaying to the user.

xsheru
  • 467
  • 4
  • 25
  • Thanks a lot for your great help. Problem is all all mobile phones will have external storage. That is why I am a bit concerned. Is it possible to use firebase cloud storage? I have not used until now – DBHari Sep 21 '19 at 18:15
  • No external storage does not mean the external memory card it is the same storage where is app installed – xsheru Sep 21 '19 at 18:30
  • Don’t get confused with external storage. Just go through external storage docs or google it for sample code. – xsheru Sep 21 '19 at 18:32
  • Sorry, I tried my best to check for any contents, but looks like I am looking at right direction. Please can you share me a link where this is available? – DBHari Sep 21 '19 at 19:12
  • This tutorial by Jerry Zhao... it might help https://www.dev2qa.com/android-read-write-external-storage-file-example/ – xsheru Sep 21 '19 at 19:30