当前位置: 首页>>代码示例>>Java>>正文


Java Thumbnails类代码示例

本文整理汇总了Java中android.provider.MediaStore.Images.Thumbnails的典型用法代码示例。如果您正苦于以下问题:Java Thumbnails类的具体用法?Java Thumbnails怎么用?Java Thumbnails使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Thumbnails类属于android.provider.MediaStore.Images包,在下文中一共展示了Thumbnails类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getThumbnail

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 得到缩略图
 */
private static HashMap<String, String> getThumbnail(ContentResolver cr) {
    String[] projection = {Thumbnails._ID, Thumbnails.IMAGE_ID,
            Thumbnails.DATA};
    Cursor cursor = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, projection,
            null, null, null);
    HashMap<String, String> thumbnailList = new HashMap<String, String>();
    if (cursor.moveToFirst()) {
        int image_id;
        String image_path;
        int image_idColumn = cursor.getColumnIndex(Thumbnails.IMAGE_ID);
        int dataColumn = cursor.getColumnIndex(Thumbnails.DATA);

        do {
            image_id = cursor.getInt(image_idColumn);
            image_path = cursor.getString(dataColumn);
            thumbnailList.put("" + image_id, image_path);
        } while (cursor.moveToNext());
        cursor.close();
    }
    return thumbnailList;
}
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:25,代码来源:ImagePathUtil.java

示例2: getThumbnailColumnData

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
     * 从数据库中得到缩略图
     *
     * @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);
                thumbnailList.put("" + image_id, image_path);
            } while (cur.moveToNext());
            cur.close();
        }
    }
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:25,代码来源:AlbumHelper.java

示例3: getThumbnail

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 得到缩略图
 */
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();
        }
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:22,代码来源:AlbumHelper.java

示例4: getThumbnailColumnData

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 从数据库中得到缩略图
 * 
 * @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());
    }
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:30,代码来源:AlbumHelper.java

示例5: doInBackground

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
@Override
protected Object doInBackground(FileItem... params) {
	Bitmap bitmap = null;
	// 鑾峰彇瑙嗛鐨勭缉鐣ュ浘
	FileItem item = params[0];
	bitmap = ThumbnailUtils.createVideoThumbnail(item.getFilePath(),
			Thumbnails.MICRO_KIND);
	bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height,
			ThumbnailUtils.OPTIONS_RECYCLE_INPUT);
	if (bitmap != null) {
		item.setIcon(bitmap);
		publishProgress();
		return bitmap;
	} else {
		return null;
	}
}
 
开发者ID:yun2win,项目名称:yun2win-sdk-android,代码行数:18,代码来源:FilesAdapter.java

示例6: getThumbnailImageFromMediaStore

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
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;
	}
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:20,代码来源:PhotoUpload.java

示例7: getThumbnailColumnData

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
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());
	}
}
 
开发者ID:Dreamer206602,项目名称:SimplifyReader2,代码行数:17,代码来源:ImagePickerHelper.java

示例8: getThumbnailColumnData

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
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());
	}
}
 
开发者ID:androidWeq,项目名称:ItHome,代码行数:27,代码来源:AlbumHelper.java

示例9: getVideoThumbnail

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
private void getVideoThumbnail() {
	String[] thumbColumns = { MediaStore.Video.Thumbnails.DATA, MediaStore.Video.Thumbnails.VIDEO_ID };
	// 视频其他信息的查询条件
	String[] mediaColumns = { MediaStore.Video.Media._ID, MediaStore.Video.Media.DATA, MediaStore.Video.Media.DURATION };
	Cursor cursor = cr.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, mediaColumns, null, null, null);
	if (null != cursor) {
		if (cursor.moveToFirst()) {
			do {
				int id = cursor.getInt(cursor.getColumnIndex(MediaStore.Video.Media._ID));
				Cursor thumbCursor = cr.query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, thumbColumns, MediaStore.Video.Thumbnails.VIDEO_ID + "=" + id, null, null);
				if (thumbCursor.moveToFirst()) {
					String thumbnails = thumbCursor.getString(thumbCursor.getColumnIndex(MediaStore.Video.Thumbnails.DATA));
					// ThumbnailUtils.createVideoThumbnail(thumbnails,
					// kind);
					thumbnailList.put("" + id, thumbnails);
				}
			} while (cursor.moveToNext());
		}
		cursor.close();
	}
}
 
开发者ID:do-android,项目名称:do_Album,代码行数:22,代码来源:AlbumHelper.java

示例10: getThumbnails

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
public void getThumbnails() {
	ContentResolver cr = getContentResolver();
	String[] projection = { Thumbnails._ID, Thumbnails.IMAGE_ID, Thumbnails.DATA };
	Cursor cur = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, projection, null, null, null);

	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.e(TAG, _id + " image_id:" + image_id + " path:" + image_path + "---");

		} while (cur.moveToNext());

	}
}
 
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:27,代码来源:PhotoSeletorActivity.java

示例11: createThumbnails

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 创建图片缩略图集合
 */
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();
}
 
开发者ID:Soniy7x,项目名称:Auie,代码行数:20,代码来源:UEImageManager.java

示例12: getBitmapFromImageId

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
public static Uri getBitmapFromImageId(Activity activity, int imageId)
{
	String[] tinyImgPprojection =
		{ MediaStore.Images.Thumbnails._ID };
	Cursor tinyCursor = Thumbnails.queryMiniThumbnail(
			activity.getContentResolver(), imageId, Thumbnails.MINI_KIND,
			tinyImgPprojection);
	if (tinyCursor.getCount() != 0)
	{
		tinyCursor.moveToFirst();
		int tinyImgId = tinyCursor.getInt(tinyCursor
				.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID));
		tinyCursor.close();
		return Uri.withAppendedPath(
				MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
				String.valueOf(tinyImgId));
	}
	else
	{
		tinyCursor.close();
		return null;
	}
}
 
开发者ID:ikantech,项目名称:IkantechSupport,代码行数:24,代码来源:YiImageUtil.java

示例13: getThumbnail

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 得到缩略图
 */
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);
}
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:11,代码来源:AlbumHelper.java

示例14: findimagepath

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 
 * 通过ContentResolver查找本地图库照片的url
 * 
 * @LastModifiedDate:2013-12-6
 * @author he
 */
private static void findimagepath(Context mContext)

{
	list = new ArrayList<String>();
	ContentResolver cr = mContext.getContentResolver();
	String[] imagedata = { Thumbnails._ID, Thumbnails.IMAGE_ID,
			Thumbnails.DATA };// 找到image
	Cursor cursor = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, imagedata,
			null, null, null); // 利用游标找image
	getColumnData(cursor);
}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:19,代码来源:GetLocalPic.java

示例15: getColumnData

import android.provider.MediaStore.Images.Thumbnails; //导入依赖的package包/类
/**
 * 
 * 通过解析游标拿取实际的值
 * 
 * @author he
 */

private static void getColumnData(Cursor cur)

{
	if (cur.moveToFirst()) {
		String image_path;
		int dataColumn = cur.getColumnIndex(Thumbnails.DATA);

		do {
			image_path = cur.getString(dataColumn);
			list.add(image_path);
		} while (cur.moveToNext());
	}
}
 
开发者ID:zhuyu1022,项目名称:amap,代码行数:21,代码来源:GetLocalPic.java


注:本文中的android.provider.MediaStore.Images.Thumbnails类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。