import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.database.Cursor;
import android.provider.MediaStore;
public class ImageProvider implements AbstructProvider {
private Context context;
public ImageProvider(Context context) {
this.context = context;
}
@Override
public List<?> getList() {
List<Image> list = null;
if (context != null) {
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null,
null, null);
if (cursor != null) {
list = new ArrayList<Image>();
while (cursor.moveToNext()) {
int id = cursor
.getInt(cursor
.getColumnIndexOrThrow(MediaStore.Images.Media._ID));
String title = cursor
.getString(cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE));
String path = cursor
.getString(cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
String displayName = cursor
.getString(cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.DISPLAY_NAME));
String mimeType = cursor
.getString(cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.MIME_TYPE));
long size = cursor
.getLong(cursor
.getColumnIndexOrThrow(MediaStore.Images.Media.SIZE));
Image audio = new Image(id, title, displayName, mimeType,
path, size);
list.add(audio);
}
cursor.close();
}
}
return list;
}
}
最近下载更多
flab615 LV1
2019年8月28日
wangshihua LV19
2019年5月10日
甩一个大耳瓜子 LV1
2018年4月17日
pzimao LV1
2017年4月23日
Crushh LV1
2017年3月12日
arronzhou LV1
2016年7月13日
1231739471907491 LV1
2016年7月12日
123== LV8
2016年6月8日
chundk LV4
2016年1月9日
蚁族-dingkai LV1
2015年12月18日

最近浏览