static final List imageswicher = Collections
.synchronizedList(new LinkedList());
private Cursor cursor;
private ArrayList list;
private ModeManager mModeManager;
/**
*
* @return ArrayList list,图片urllist集合
*/
private ArrayList getImgPathList() {
list = new ArrayList();
cursor = getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[] { "_id", "_data" }, null, null, null);
while (cursor.moveToNext()) {
list.add(0, cursor.getString(1));
Log.i("cursorItemUrl", cursor.getString(1) + "");
}
cursor.close();
return list;
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_scan);
ArrayList listImgPath = getImgPathList();
// 将图片url集合转为string数组
imageUrls = (String[]) listImgPath.toArray(new String[listImgPath
.size()]);
// 加本地资源路径前缀
for (int i = 0; i < imageUrls.length; i++) {
imageUrls[i] = "file://" + imageUrls[i];
}