Load all images from folder in Android

前端 未结 3 1265
有刺的猬
有刺的猬 2021-01-15 16:50

I would like to load all images in a folder without knowing the names of the files and store them into a Integer vector - at runtime.

In fact, i need the same as it

3条回答
  •  北荒
    北荒 (楼主)
    2021-01-15 17:09

    To get all files of a specific folder, use the list()-method of the File-class, which lists all Files of the specified directory.

    To create a Bitmap (which can then be drawn), you can use the BitmapFactory-class.

    After that, you'll need to create your own Adapter (as shown in the linked tutorial) to show your Bitmaps.

提交回复
热议问题