The task is this: you need to implement a slider on android, using images that are stored in the system folders of the android. I implemented receiving files from the system, then I found a ready-made library with a slider, connected it, but in the tutorial to the library the following code:

adapter = new ResourceBitmapAdapter(this, new int[]{ R.raw.slide_01, R.raw.slide_02, R.raw.slide_03, R.raw.slide_04}); 

The adapter creates an array into which resources are placed, but my images are taken from the system folders. In general, how in the adapter zaphnut the path to the system images on the phone?

  • look at the source of the library, there is an adapter for normal bitmaps. For example BitmapAdapter.java - Vladyslav Matviienko
  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

1 answer 1

In theory, you just need to run through the folder where the system drawable

 Field[] drawables = android.R.drawable.class.getFields(); for (Field field : drawables) { try { list.add(field.getInt(null)); //создайте список и кладите в него интовое значение ресурса } catch (Exception e) { e.printStackTrace(); } }