-2

Imagine you want to set a picture for your profile, applications lets you to open your gallery or take a picture. BUT in my case I want to let user to select a picture from a set of images which I have designed already, then I want my app to pop up a window which contains image set and let user to browse between them and finally select one. What is the best practice to accomplish this? Thanks in advance.

RGM
  • 1
  • 4
  • Where u want to store the image selected? – Chandan kushwaha Sep 15 '18 at 06:50
  • I want to use it inside application for user icon, I don't know where it may save, maybe in drawable – RGM Sep 15 '18 at 07:59
  • What have you tried so far? What errors did you get? – TDG Sep 15 '18 at 08:00
  • I tried this: Intent intent = new Intent(Intent.ACTION_VIEW); String path = "/res/raw" Uri uri = Uri.parse(path); intent.setDataAndType(uri, "*/*"); startActivity(intent); and corresponding error was: No Activity found to handle Intent { act=android.intent.action.OPEN_DOCUMENT dat=android.resource://com.toosfuse.listview/2131427328 typ=*/* } – RGM Sep 15 '18 at 08:04
  • Possible duplicate of [How to get all Drawable resources?](https://stackoverflow.com/questions/31921927/how-to-get-all-drawable-resources) – longi Sep 15 '18 at 08:16

1 Answers1

0

Finally I have solved my problem using a combination of GridView and intent concept (startActivityForResult). In my solution I have created a GridView and put my images in an Integer array, one by one; then my gridView displays items and after I select one image, it sends result to Main Activity.

RGM
  • 1
  • 4