android.provider.MediaStore.Images.Thumbnails Java Examples

The following examples show how to use android.provider.MediaStore.Images.Thumbnails. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlbumHelper.java    From sctalk with Apache License 2.0 6 votes vote down vote up
/**
 * 得到缩略图
 */
private void getThumbnail() {
    String[] projection = {
            Thumbnails._ID, Thumbnails.IMAGE_ID,
            Thumbnails.DATA
    };
    Cursor cursor = null;
    try {
        cursor = contentResolver.query(Thumbnails.EXTERNAL_CONTENT_URI,
                projection, null, null, null);
        getThumbnailColumnData(cursor);
    } catch (Exception e) {
        logger.e(e.getMessage());
    } finally {
        if (null != cursor) {
            cursor.close();
        }
    }
}
 
Example #2
Source File: AlbumHelper.java    From sctalk with Apache License 2.0 6 votes vote down vote up
/**
 * 从数据库中得到缩略图
 * 
 * @param cur
 */
private void getThumbnailColumnData(Cursor cur) {
    try {
        if (null == cur)
            return;
        if (cur.moveToFirst()) {
            @SuppressWarnings("unused")
            int cId;
            int image_id;
            String image_path;
            int _idColumn = cur.getColumnIndex(Thumbnails._ID);
            int image_idColumn = cur.getColumnIndex(Thumbnails.IMAGE_ID);
            int dataColumn = cur.getColumnIndex(Thumbnails.DATA);

            do {
                cId = cur.getInt(_idColumn);
                image_id = cur.getInt(image_idColumn);
                image_path = cur.getString(dataColumn);
                thumbnailList.put("" + image_id, image_path);
            } while (cur.moveToNext());
        }
    } catch (Exception e) {
        logger.e(e.getMessage());
    }
}
 
Example #3
Source File: ImagePickerHelper.java    From SimplifyReader with Apache License 2.0 6 votes vote down vote up
private void getThumbnailColumnData(Cursor cur) {
	mThumbnailList.clear();
	if (cur.moveToFirst()) {
		int image_id;
		int image_idColumn = cur.getColumnIndex(Thumbnails.IMAGE_ID);
		int dataColumn = cur.getColumnIndex(Thumbnails.DATA);
		String image_path;

		do {
			image_id = cur.getInt(image_idColumn);
			image_path = cur.getString(dataColumn);

			mThumbnailList.put("" + image_id, image_path);
		} while (cur.moveToNext());
	}
}
 
Example #4
Source File: AlbumHelper.java    From school_shop with MIT License 6 votes vote down vote up
private void getThumbnailColumnData(Cursor cur) {
	if (cur.moveToFirst()) {
		int _id;
		int image_id;
		String image_path;
		int _idColumn = cur.getColumnIndex(Thumbnails._ID);
		int image_idColumn = cur.getColumnIndex(Thumbnails.IMAGE_ID);
		int dataColumn = cur.getColumnIndex(Thumbnails.DATA);

		do {
			// Get the field values
			_id = cur.getInt(_idColumn);
			image_id = cur.getInt(image_idColumn);
			image_path = cur.getString(dataColumn);

			// Do something with the values.
			// Log.i(TAG, _id + " image_id:" + image_id + " path:"
			// + image_path + "---");
			// HashMap<String, String> hash = new HashMap<String, String>();
			// hash.put("image_id", image_id + "");
			// hash.put("path", image_path);
			// thumbnailList.add(hash);
			thumbnailList.put("" + image_id, image_path);
		} while (cur.moveToNext());
	}
}
 
Example #5
Source File: UEImageManager.java    From Auie with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 创建图片缩略图集合
 */
private void createThumbnails(){
	Cursor cursor = mContentResolver.query(Thumbnails.EXTERNAL_CONTENT_URI, THUMBNAILS_PROJECTTION, null, null, null);
	if (cursor.moveToFirst()) {
		int id;
		String data;
		int idIndex  = cursor.getColumnIndex(Thumbnails.IMAGE_ID);
		int dataIndex = cursor.getColumnIndex(Thumbnails.DATA);
		thumbnails.clear();
		do{
			id = cursor.getInt(idIndex );
			data = cursor.getString(dataIndex);
			thumbnails.put(String.valueOf(id), data);
		}while(cursor.moveToNext());
	}
	cursor.close();
}
 
Example #6
Source File: PhotoUpload.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
private Bitmap getThumbnailImageFromMediaStore(Context context) {
	Resources res = context.getResources();

	final int kind = Thumbnails.MINI_KIND;

	BitmapFactory.Options opts = new BitmapFactory.Options();
	opts = new BitmapFactory.Options();

	try {
		final long id = Long.parseLong(getOriginalPhotoUri()
				.getLastPathSegment());
		Bitmap bitmap = Thumbnails.getThumbnail(
				context.getContentResolver(), id, kind, opts);
		bitmap = Utils.rotate(bitmap, getExifRotation(context));
		return bitmap;
	} catch (Exception e) {
		return null;
	}
}
 
Example #7
Source File: AlbumHelper.java    From quickmark with MIT License 5 votes vote down vote up
/**
 * �õ�����ͼ
 */
private void getThumbnail() {
	String[] projection = { Thumbnails._ID, Thumbnails.IMAGE_ID,
			Thumbnails.DATA };
	Cursor cursor = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, projection,
			null, null, null);
	getThumbnailColumnData(cursor);
}
 
Example #8
Source File: AlbumHelper.java    From quickmark with MIT License 5 votes vote down vote up
/**
 * �����ݿ��еõ�����ͼ
 * 
 * @param cur
 */
private void getThumbnailColumnData(Cursor cur) {
	if (cur.moveToFirst()) {
		int _id;
		int image_id;
		String image_path;
		int _idColumn = cur.getColumnIndex(Thumbnails._ID);
		int image_idColumn = cur.getColumnIndex(Thumbnails.IMAGE_ID);
		int dataColumn = cur.getColumnIndex(Thumbnails.DATA);

		do {
			// Get the field values
			_id = cur.getInt(_idColumn);
			image_id = cur.getInt(image_idColumn);
			image_path = cur.getString(dataColumn);

			// Do something with the values.
			// Log.i(TAG, _id + " image_id:" + image_id + " path:"
			// + image_path + "---");
			// HashMap<String, String> hash = new HashMap<String, String>();
			// hash.put("image_id", image_id + "");
			// hash.put("path", image_path);
			// thumbnailList.add(hash);
			thumbnailList.put("" + image_id, image_path);
		} while (cur.moveToNext());
	}
}
 
Example #9
Source File: AlbumHelper.java    From school_shop with MIT License 5 votes vote down vote up
private void getThumbnail() {
	String[] projection = { Thumbnails._ID, Thumbnails.IMAGE_ID,
			Thumbnails.DATA };
	Cursor cursor = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, projection,
			null, null, null);
	getThumbnailColumnData(cursor);
}
 
Example #10
Source File: AlbumHelper.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * 得到缩略图
 */
private void getThumbnail() {
	String[] projection = { Thumbnails._ID, Thumbnails.IMAGE_ID,
			Thumbnails.DATA };
	Cursor cursor = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, projection,
			null, null, null);
	getThumbnailColumnData(cursor);
}
 
Example #11
Source File: AlbumHelper.java    From UltimateAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * 从数据库中得到缩略图
 * 
 * @param cur
 */
private void getThumbnailColumnData(Cursor cur) {
	if (cur.moveToFirst()) {
		int _id;
		int image_id;
		String image_path;
		int _idColumn = cur.getColumnIndex(Thumbnails._ID);
		int image_idColumn = cur.getColumnIndex(Thumbnails.IMAGE_ID);
		int dataColumn = cur.getColumnIndex(Thumbnails.DATA);

		do {
			// Get the field values
			_id = cur.getInt(_idColumn);
			image_id = cur.getInt(image_idColumn);
			image_path = cur.getString(dataColumn);

			// Do something with the values.
			// Log.i(TAG, _id + " image_id:" + image_id + " path:"
			// + image_path + "---");
			// HashMap<String, String> hash = new HashMap<String, String>();
			// hash.put("image_id", image_id + "");
			// hash.put("path", image_path);
			// thumbnailList.add(hash);
			thumbnailList.put("" + image_id, image_path);
		} while (cur.moveToNext());
	}
}
 
Example #12
Source File: CameraUtils.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
/** 创建视频缩略图,返回缩略图文件路径 */
public String createVideoThumbnail(String filePath, String fileName){
    Bitmap videoThumb = ThumbnailUtils.createVideoThumbnail(filePath, Thumbnails.MINI_KIND);  //关键代码!!
    return saveBitmap(videoThumb, fileName);  //注:saveBitmap方法为保存图片并返回路径的private方法

}
 
Example #13
Source File: ImagePickerHelper.java    From SimplifyReader with Apache License 2.0 4 votes vote down vote up
private void getThumbnail() {
	String[] projection = { Thumbnails._ID, Thumbnails.IMAGE_ID, Thumbnails.DATA };
	Cursor cursor = contentResolver.query(Thumbnails.EXTERNAL_CONTENT_URI, projection, null, null, null);
	getThumbnailColumnData(cursor);
}