Android How can I load every images from the drawable folder using file to set into the imageItems? -


how can load image drawable folder when don't know image file name.

i want show drawable folder image in gridview.

i know how load image file name, below:

 // imageitem  method :public imageitem(bitmap imagebitmap, string title){...}    private arraylist<imageitem> getdata()      {          final arraylist<imageitem> imageitems = new arraylist<>();          typedarray imgs = mcontext.getresources().obtaintypedarray(r.array.image_ids);           for( int = 0 ; i< imgs.length(); i++ )          {              bitmap bitmap =      bitmapfactory.decoderesource(mcontext.getresources(), imgs.getresourceid(i, -1));              imageitems.add(new imageitem(bitmap, "image#" + i));          }           return imageitems;      } 

but if don't know file name(r.drawable.filename), how can load every images drawable folder using file set imageitems?

thank much.

field[] drawables = android.r.drawable.class.getfields(); (field f : drawables) {     try {         log.i("log", "r.drawable." + f.getname());     } catch (exception e) {         e.printstacktrace();     } } 

try


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -