我正在尝试在图库视图中显示存储在 SD 卡中的所有图像。
我曾尝试使用内容提供程序(android.provider.MediaStore.images.Media 类),但似乎卡在了某个点上。不确定这是否是解决方法。
到目前为止,这是我的代码:
String[] colsNeeded = new String[]{Media._ID, Media.TITLE};
Uri mMedia = Media.EXTERNAL_CONTENT_URI;
//Create a cursor using the URI & column names needd
Cursor c = managedQuery(mMedia, colsNeeded, null, null, Media.DATE_TAKEN + " ASC");
//What kind of adapter should I create here
//that contains images from the cursor??
SpinnerAdapter sa = null; //This is the point I get stuck
//Set the adapter of the gallery view
Gallery galleryPetPhotos = (Gallery)findViewById(R.id.GalleryPetPhotos);
galleryPetPhotos.setAdapter(sa);
只要朝正确的方向轻推,将不胜感激。