我将来自Gallery的手机图像的所有URI都包含在:
false
其输出是:
for(String item: items) {
Log.d("Images", item);
}
我想在gridview中填充这些内容。我们可以将Drawable中的静态图像设置为:
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150425_131643.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_213547.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_213646.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_221519.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_221530.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_221544.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_221628.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_222055.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_222533_HDR.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_222541_HDR.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_222552_HDR.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_222637_HDR.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150426_222643_HDR.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150429_205140_HDR.jpg
07-04 17:30:22.633 11140-11140/com.example.android.HomeWork2 D/Images﹕ /storage/emulated/0/DCIM/Camera/IMG_20150429_205148_HDR.jpg
其中:
imageView.setImageResource(mThumbIds[position]);
我的gridview是:
private Integer[] mThumbIds = {
R.drawable.ic_launcher,R.drawable.ic_launcher
};
我想知道如何动态设置图像,因为我不知道图库中有多少图像及其URI直到运行时。