i would like to Display an image gallery but from "assets/images" folder not from the phone storage.
Asked
Active
Viewed 65 times
-6
-
1Stack Overflow is for programming questions. What is your question? If your question is "how do I do this?", please explain what you have tried and what specific problems you have encountered. – CommonsWare Jun 05 '17 at 18:32
-
im asking to how to do it? ^_^ cause im new in android so im asking if someone can give me a way to do it – Sabri Boughanmi Jun 05 '17 at 18:49
-
3That's too broad. You should consider looking up some tutorials that will build you up to this point. – Lexi Jun 05 '17 at 18:52
1 Answers
0
The question is not clear, if you want to load a single image from assets, then you can do it this way.
//read image from asset
InputStream is = getAssets().open("image.jpg");
// create a drawable
Drawable drawable = Drawable.createFromStream(is, null);
//find reference to your imageview and set drawable
ImageView i=(ImageView)findViewById(R.id.image_id);
i.setImageDrawable(drawable);

Adithya
- 1,688
- 1
- 10
- 18
-
i asked for displaying a gallery of images like the image i added so i dont think i need to display a single image ^_^ thank you anyway – Sabri Boughanmi Jun 05 '17 at 18:38
-
add these to an ArrayList & add these drawables to it.use a GridView to display it. – Adithya Jun 05 '17 at 18:42