<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      android 獲取視頻和圖片的縮略圖

      要得到圖片的縮略圖,可以有兩種方法:
      一種是利用BitmapFactory中的decodeFile對圖片進行壓縮。
      一種是直接取縮略圖
      直接訪問 android.provider.MediaStore.Images.Thumbnails 和android.provider.MediaStore.Video.Thumbnails這兩個數據庫,可以獲得設備中圖片和視頻的縮略圖
      // 取縮略圖的方法
      cr = getContentResolver();
      String[] projection = { Thumbnails._ID, Thumbnails.IMAGE_ID, Thumbnails.DATA };
      Cursor cursor = cr.query(Thumbnails.EXTERNAL_CONTENT_URI, projection, null, null, null);
      getColumnData(cursor);

      private void getColumnData(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);
                  list.add(hash);

              } while (cur.moveToNext());

           }
      }
      // 取實際圖片的方法
      String columns[] = new String[] { Media.DATA, Media._ID, Media.TITLE, Media.DISPLAY_NAME, Media.SIZE };  
      // 得到一個游標  
      cursor = this.getContentResolver().query(Media.EXTERNAL_CONTENT_URI, columns, null, null, null);  
      // 獲取指定列的索引  
      photoIndex = cursor.getColumnIndexOrThrow(Media.DATA);  
      photoNameIndex = cursor.getColumnIndexOrThrow(Media.DISPLAY_NAME);  
      photoIDIndex = cursor.getColumnIndexOrThrow(Media._ID);  
      photoTitleIndex = cursor.getColumnIndexOrThrow(Media.TITLE);  
      photoSizeIndex = cursor.getColumnIndexOrThrow(Media.SIZE);  
      // 獲取圖片總數  
      totalNum = cursor.getCount();

      // 因為縮略圖數據庫和實際圖數據庫的id是相同的,所以可以根據取出的縮略圖的id去找開真正的圖片
      OnItemClickListener listener = new OnItemClickListener() {   
          @Override  
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {  
              // TODO Auto-generated method stub  
              String image_id = list.get(position).get("image_id");  
              Log.i(TAG, "---(^o^)----" + image_id);  
             String[] projection = { Media._ID, Media.DATA };  
             Cursor cursor = cr.query(Media.EXTERNAL_CONTENT_URI, projection,  
                                   Media._ID + "=" + image_id, null, null);  
             if (cursor != null) {  
                 cursor.moveToFirst();  
                 String path = cursor.getString(cursor.getColumnIndex(Media.DATA));  
                 Intent intent = new Intent(ThumbnailActivity.this, ImageViewer.class);  
                 intent.putExtra("path", path);  
                 startActivity(intent);  
             } else {  
                 Toast.makeText(ThumbnailActivity.this, "Image doesn't exist!",  
                                       Toast.LENGTH_SHORT).show();  
                }
            }  
      };
      有關具體的縮略圖可以通過getThumbnail(ContentResolver cr, long origId, int kind, BitmapFactory.Options options) 或getThumbnail(ContentResolver cr, long origId, long groupId, int kind, BitmapFactory.Options options) 方法獲取,這兩種方法返回Bitmap類型,而縮略圖的分辨率可以從HEIGHT和WIDTH兩個字段提取,在Android上縮略圖分為兩種,通過讀取 KIND字段來獲得,分別為MICRO_KIND和MINI_KIND 分別為微型和迷你兩種縮略模式,前者的分辨率更低。這樣我們平時獲取文件系統的某個圖片預覽時,可以直接調用系統縮略圖,而不用自己重新計算。

      縮略圖保存在SD卡的DCIM目錄,里面的.thumbnails是圖片的,而.video_thumbnails是視頻的,這兩個文件夾為隱藏屬性
      --------------------------------------------------------------------------------------
      從Android2.2開始系統新增了一個縮略圖ThumbnailUtils類,位于framework的 android.media.ThumbnailUtils位置,可以幫助我們從mediaprovider中獲取系統中的視頻或圖片文件的縮略圖,該類提供了三種靜態方法可以直接調用獲取。

      1. static Bitmap createVideoThumbnail(String filePath, int kind)
      //獲取視頻文件的縮略圖,第一個參數為視頻文件的位置,比如/sdcard/android123.3gp,而第二個參數可以為MINI_KIND或 MICRO_KIND最終和分辨率有關

      2. static Bitmap extractThumbnail(Bitmap source, int width, int height, int options)
      //直接對Bitmap進行縮略操作,最后一個參數定義為OPTIONS_RECYCLE_INPUT,來回收資源

      3. static Bitmap extractThumbnail(Bitmap source, int width, int height)
      // 這個和上面的方法一樣,無options選項
      --------------------------------------------------------------------------------------
      獲取音頻文件:
       Cursor cursor = getContentResolver().query(  
                       MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, null, null, null,  
                       MediaStore.Audio.Media.DEFAULT_SORT_ORDER);  
       cursor.moveToFirst();  
      int counter = cursor.getCount();  
      String title = cursor.getString(cursor  
                       .getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE));  
         
      Log.w("tag", "before looping,title=" + title);  
      for (int j = 0; j < counter; j++) {  
          Log.w("tag", "title=" + cursor.getString(cursor  
                           .getColumnIndex(MediaStore.Audio.Media.TITLE)));  
          cursor.moveToNext();  
      }  
      cursor.close();
      ---------------------------------------------------------------------------------------
      增加,代碼如下所以:

      ContentValues values = new ContentValues();  
      values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER,0);  
      resolver.insert(_uri, values);  
      ContentValues values = new ContentValues();
      values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER,0);
      resolver.insert(_uri, values);

      這個insert傳遞的參數只有兩個,一個是Uri(同查詢那個Uri),另一個是ContentValues。這個ContentValuses對應于數據庫的一行數據,只要用put方法把每個列的設置好之后,直接利用insert方
      法去插入就好了。

      更新,代碼如下:

      ContentResolver resolver = ctx.getContentResolver();  
      Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;  
      ContentValues values = new ContentValues();  
      values.put(MediaStore.Audio.Media.DATE_MODIFIED, sid);  
      resolver.update(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,values, where, selectionArgs);  
      ContentResolver resolver = ctx.getContentResolver();
      Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
      ContentValues values = new ContentValues();
      values.put(MediaStore.Audio.Media.DATE_MODIFIED, sid);
      resolver.update(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,values, where, selectionArgs);

      上面update方法和查詢還有增加里的參數都很類似,這里就不再重復敘述了,大家也可直接參考google的文檔,那里也寫的很清楚。

      刪除,代碼如下:

      ContentResolver resolver = ctx.getContentResolver();  
      resolver.delete(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,where, selectionArgs);  
      ContentResolver resolver = ctx.getContentResolver();
      resolver.delete(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,where, selectionArgs);

      //--------------------------------------------------------------------------------
      在實際開發中遇到一個問題,只能讀出一個文件的縮略圖,在/mnt/sdcard/DCIM/.Thumbnails下,也只有一個縮略圖文件
      另外還有一個文件 image_last_thumb
      因時間太緊張沒有清楚查到原因,網上有說是和sd卡的類型有關,因為不明白原因,無奈之下只有使用取原圖壓縮的辦法。
      http://forum.xda-developers.com/showthread.php?t=558168&page=2
      // -------------------------------------------------------------------------------
      http://www.netmite.com/android/mydroid/donut/packages/apps/Camera/src/com/android/camera/ImageManager.java

      /*
       * Copyright (C) 2007 The Android Open Source Project
       *
       * Licensed under the Apache License, Version 2.0 (the "License");
       * you may not use this file except in compliance with the License.
       * You may obtain a copy of the License at
       *
       *      http://www.apache.org/licenses/LICENSE-2.0
       *
       * Unless required by applicable law or agreed to in writing, software
       * distributed under the License is distributed on an "AS IS" BASIS,
       * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       * See the License for the specific language governing permissions and
       * limitations under the License.
       */

      package com.android.camera;

      import com.android.camera.gallery.BaseCancelable;
      import com.android.camera.gallery.BaseImageList;
      import com.android.camera.gallery.Cancelable;
      import com.android.camera.gallery.DrmImageList;
      import com.android.camera.gallery.IImage;
      import com.android.camera.gallery.IImageList;
      import com.android.camera.gallery.Image;
      import com.android.camera.gallery.ImageList;
      import com.android.camera.gallery.ImageListUber;
      import com.android.camera.gallery.SingleImageList;
      import com.android.camera.gallery.VideoList;
      import com.android.camera.gallery.VideoObject;

      import android.content.ContentResolver;
      import android.content.ContentUris;
      import android.content.ContentValues;
      import android.database.Cursor;
      import android.graphics.Bitmap;
      import android.location.Location;
      import android.net.Uri;
      import android.os.Environment;
      import android.os.Parcel;
      import android.provider.DrmStore;
      import android.provider.MediaStore;
      import android.provider.MediaStore.Images;
      import android.provider.MediaStore.Images.ImageColumns;
      import android.util.Log;

      import java.io.File;
      import java.io.IOException;
      import java.util.ArrayList;
      import java.util.HashMap;
      import java.util.Iterator;
      import java.util.concurrent.ExecutionException;

      /**
       * ImageManager is used to retrieve and store images
       * in the media content provider.
       */
      public class ImageManager {
          private static final String TAG = "ImageManager";

          private static final Uri STORAGE_URI = Images.Media.EXTERNAL_CONTENT_URI;
          private static final Uri THUMB_URI
                  = Images.Thumbnails.EXTERNAL_CONTENT_URI;

          private static final Uri VIDEO_STORAGE_URI =
                  Uri.parse("content://media/external/video/media");

          /**
           * Enumerate type for the location of the images in gallery.
           */
          public static enum DataLocation { NONE, INTERNAL, EXTERNAL, ALL }

          public static final Bitmap DEFAULT_THUMBNAIL =
                  Bitmap.createBitmap(32, 32, Bitmap.Config.RGB_565);
          public static final Bitmap NO_IMAGE_BITMAP =
                  Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);

          public static final int SORT_ASCENDING = 1;
          public static final int SORT_DESCENDING = 2;

          public static final int INCLUDE_IMAGES = (1 << 0);
          public static final int INCLUDE_DRM_IMAGES = (1 << 1);
          public static final int INCLUDE_VIDEOS = (1 << 2);

          public static final String CAMERA_IMAGE_BUCKET_NAME =
                  Environment.getExternalStorageDirectory().toString()
                  + "/DCIM/Camera";
          public static final String CAMERA_IMAGE_BUCKET_ID =
                  getBucketId(CAMERA_IMAGE_BUCKET_NAME);

          /**
           * Matches code in MediaProvider.computeBucketValues. Should be a common
           * function.
           */
          public static String getBucketId(String path) {
              return String.valueOf(path.toLowerCase().hashCode());
          }

          /**
           * OSX requires plugged-in USB storage to have path /DCIM/NNNAAAAA to be
           * imported. This is a temporary fix for bug#1655552.
           */
          public static void ensureOSXCompatibleFolder() {
              File nnnAAAAA = new File(
                  Environment.getExternalStorageDirectory().toString()
                  + "/DCIM/100ANDRO");
              if ((!nnnAAAAA.exists()) && (!nnnAAAAA.mkdir())) {
                  Log.e(TAG, "create NNNAAAAA file: " + nnnAAAAA.getPath()
                          + " failed");
              }
          }

          public static int roundOrientation(int orientationInput) {
              int orientation = orientationInput;
              if (orientation == -1) {
                  orientation = 0;
              }

              orientation = orientation % 360;
              int retVal;
              if (orientation < (0 * 90) + 45) {
                  retVal = 0;
              } else if (orientation < (1 * 90) + 45) {
                  retVal = 90;
              } else if (orientation < (2 * 90) + 45) {
                  retVal = 180;
              } else if (orientation < (3 * 90) + 45) {
                  retVal = 270;
              } else {
                  retVal = 0;
              }

              return retVal;
          }

          /**
           * @return true if the mimetype is an image mimetype.
           */
          public static boolean isImageMimeType(String mimeType) {
              return mimeType.startsWith("image/");
          }

          /**
           * @return true if the mimetype is a video mimetype.
           */
          public static boolean isVideoMimeType(String mimeType) {
              return mimeType.startsWith("video/");
          }

          /**
           * @return true if the image is an image.
           */
          public static boolean isImage(IImage image) {
              return isImageMimeType(image.getMimeType());
          }

          /**
           * @return true if the image is a video.
           */
          public static boolean isVideo(IImage image) {
              // This is the right implementation, but we use instanceof for speed.
              //return isVideoMimeType(image.getMimeType());
              return (image instanceof VideoObject);
          }

          public static void setImageSize(ContentResolver cr, Uri uri, long size) {
              ContentValues values = new ContentValues();
              values.put(Images.Media.SIZE, size);
              cr.update(uri, values, null, null);
          }

          public static Uri addImage(ContentResolver cr, String title,
                  long dateTaken, Location location,
                  int orientation, String directory, String filename) {

              ContentValues values = new ContentValues(7);
              values.put(Images.Media.TITLE, title);

              // That filename is what will be handed to Gmail when a user shares a
              // photo. Gmail gets the name of the picture attachment from the
              // "DISPLAY_NAME" field.
              values.put(Images.Media.DISPLAY_NAME, filename);
              values.put(Images.Media.DATE_TAKEN, dateTaken);
              values.put(Images.Media.MIME_TYPE, "image/jpeg");
              values.put(Images.Media.ORIENTATION, orientation);

              if (location != null) {
                  values.put(Images.Media.LATITUDE, location.getLatitude());
                  values.put(Images.Media.LONGITUDE, location.getLongitude());
              }

              if (directory != null && filename != null) {
                  String value = directory + "/" + filename;
                  values.put(Images.Media.DATA, value);
              }

              return cr.insert(STORAGE_URI, values);
          }

          private static class AddImageCancelable extends BaseCancelable<Void> {
              private final Uri mUri;
              private final ContentResolver mCr;
              private final int mOrientation;
              private final Bitmap mSource;
              private final byte [] mJpegData;

              public AddImageCancelable(Uri uri, ContentResolver cr,
                      int orientation, Bitmap source, byte[] jpegData) {
                  if (source == null && jpegData == null || uri == null) {
                      throw new IllegalArgumentException("source cannot be null");
                  }
                  mUri = uri;
                  mCr = cr;
                  mOrientation = orientation;
                  mSource = source;
                  mJpegData = jpegData;
              }

              @Override
              protected Void execute() throws InterruptedException,
                      ExecutionException {
                  boolean complete = false;
                  try {
                      long id = ContentUris.parseId(mUri);
                      BaseImageList il = new ImageList(
                              STORAGE_URI, THUMB_URI, SORT_ASCENDING, null);
                      il.open(mCr);

                      // TODO: Redesign the process of adding new images. We should
                      //     create an <code>IImage</code> in "ImageManager.addImage"
                      //     and pass the image object to here.
                      Image image = new Image(il, mCr, id, 0, il.contentUri(id), null,
                              0, null, 0, null, null, 0);
                      String[] projection = new String[] {
                              ImageColumns._ID,
                              ImageColumns.MINI_THUMB_MAGIC, ImageColumns.DATA};
                      Cursor c = mCr.query(mUri, projection, null, null, null);
                      String filepath;
                      try {
                          c.moveToPosition(0);
                          filepath = c.getString(2);
                      } finally {
                          c.close();
                      }
                      runSubTask(image.saveImageContents(
                              mSource, mJpegData, mOrientation, true, filepath));

                      ContentValues values = new ContentValues();
                      values.put(ImageColumns.MINI_THUMB_MAGIC, 0);
                      mCr.update(mUri, values, null, null);
                      complete = true;
                      return null;
                  } finally {
                      if (!complete) {
                          try {
                              mCr.delete(mUri, null, null);
                          } catch (Throwable t) {
                              // ignore it while clean up.
                          }
                      }
                  }
              }
          }

          public static Cancelable<Void> storeImage(
                  Uri uri, ContentResolver cr, int orientation,
                  Bitmap source, byte [] jpegData) {
              return new AddImageCancelable(
                      uri, cr, orientation, source, jpegData);
          }

          public static IImageList makeImageList(Uri uri, ContentResolver cr,
                  int sort) {
              String uriString = (uri != null) ? uri.toString() : "";

              // TODO: we need to figure out whether we're viewing
              // DRM images in a better way.  Is there a constant
              // for content://drm somewhere??
              IImageList imageList;

              if (uriString.startsWith("content://drm")) {
                  imageList = ImageManager.allImages(
                          cr, ImageManager.DataLocation.ALL,
                          ImageManager.INCLUDE_DRM_IMAGES, sort);
              } else if (uriString.startsWith("content://media/external/video")) {
                  imageList = ImageManager.allImages(
                      cr, ImageManager.DataLocation.EXTERNAL,
                      ImageManager.INCLUDE_VIDEOS, sort);
              } else if (isSingleImageMode(uriString)) {
                  imageList = new SingleImageList(uri);
                  ((SingleImageList) imageList).open(cr);
              } else {
                  String bucketId = uri.getQueryParameter("bucketId");
                  imageList = ImageManager.allImages(
                      cr, ImageManager.DataLocation.ALL,
                      ImageManager.INCLUDE_IMAGES, sort, bucketId);
              }
              return imageList;
          }

          static boolean isSingleImageMode(String uriString) {
              return !uriString.startsWith(
                      MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString())
                      && !uriString.startsWith(
                      MediaStore.Images.Media.INTERNAL_CONTENT_URI.toString());
          }

          private static class EmptyImageList implements IImageList {
              public static final Creator<EmptyImageList> CREATOR =
                      new Creator<EmptyImageList>() {
                  public EmptyImageList createFromParcel(Parcel in) {
                      return new EmptyImageList();
                  }

                  public EmptyImageList[] newArray(int size) {
                      return new EmptyImageList[size];
                  }
              };

              public void open(ContentResolver resolver) {
              }

              public void close() {
              }

              public void checkThumbnail(int index) {
              }

              public void deactivate() {
              }

              public HashMap<String, String> getBucketIds() {
                  return new HashMap<String, String>();
              }

              public int getCount() {
                  return 0;
              }

              public boolean isEmpty() {
                  return true;
              }

              public IImage getImageAt(int i) {
                  return null;
              }

              public IImage getImageForUri(Uri uri) {
                  return null;
              }

              public boolean removeImage(IImage image) {
                  return false;
              }

              public boolean removeImageAt(int i) {
                  return false;
              }

              public int getImageIndex(IImage image) {
                  throw new UnsupportedOperationException();
              }

              public int describeContents() {
                  return 0;
              }

              public void writeToParcel(Parcel dest, int flags) {
              }
          }

          public static IImageList emptyImageList() {
              return new EmptyImageList();
          }

          public static IImageList allImages(ContentResolver cr,
                  DataLocation location, int inclusion, int sort) {
              return allImages(cr, location, inclusion, sort, null);
          }

          public static IImageList allImages(ContentResolver cr,
                  DataLocation location, int inclusion, int sort, String bucketId) {
              if (cr == null) {
                  return null;
              }

              // false ==> don't require write access
              boolean haveSdCard = hasStorage(false);

              // use this code to merge videos and stills into the same list
              ArrayList<BaseImageList> l = new ArrayList<BaseImageList>();

              if (haveSdCard && location != DataLocation.INTERNAL) {
                  if ((inclusion & INCLUDE_IMAGES) != 0) {
                      l.add(new ImageList(
                              STORAGE_URI, THUMB_URI, sort, bucketId));
                  }
                  if ((inclusion & INCLUDE_VIDEOS) != 0) {
                      l.add(new VideoList(VIDEO_STORAGE_URI, sort, bucketId));
                  }
              }
              if (location == DataLocation.INTERNAL || location == DataLocation.ALL) {
                  if ((inclusion & INCLUDE_IMAGES) != 0) {
                      l.add(new ImageList(
                              Images.Media.INTERNAL_CONTENT_URI,
                              Images.Thumbnails.INTERNAL_CONTENT_URI,
                              sort, bucketId));
                  }
                  if ((inclusion & INCLUDE_DRM_IMAGES) != 0) {
                      l.add(new DrmImageList(
                              DrmStore.Images.CONTENT_URI, sort, bucketId));
                  }
              }

              // Optimization: If some of the lists are empty, remove them.
              // If there is only one remaining list, return it directly.
              Iterator<BaseImageList> iter = l.iterator();
              while (iter.hasNext()) {
                  BaseImageList sublist = iter.next();
                  sublist.open(cr);
                  if (sublist.isEmpty()) iter.remove();
                  sublist.close();
              }

              if (l.size() == 1) {
                  BaseImageList list = l.get(0);
                  list.open(cr);
                  return list;
              }

              ImageListUber uber = new ImageListUber(
                      l.toArray(new IImageList[l.size()]), sort);
              uber.open(cr);
              return uber;
          }

          private static boolean checkFsWritable() {
              // Create a temporary file to see whether a volume is really writeable.
              // It's important not to put it in the root directory which may have a
              // limit on the number of files.
              String directoryName =
                      Environment.getExternalStorageDirectory().toString() + "/DCIM";
              File directory = new File(directoryName);
              if (!directory.isDirectory()) {
                  if (!directory.mkdirs()) {
                      return false;
                  }
              }
              File f = new File(directoryName, ".probe");
              try {
                  // Remove stale file if any
                  if (f.exists()) {
                      f.delete();
                  }
                  if (!f.createNewFile()) {
                      return false;
                  }
                  f.delete();
                  return true;
              } catch (IOException ex) {
                  return false;
              }
          }

          public static boolean hasStorage() {
              return hasStorage(true);
          }

          public static boolean hasStorage(boolean requireWriteAccess) {
              String state = Environment.getExternalStorageState();

              if (Environment.MEDIA_MOUNTED.equals(state)) {
                  if (requireWriteAccess) {
                      boolean writable = checkFsWritable();
                      return writable;
                  } else {
                      return true;
                  }
              } else if (!requireWriteAccess
                      && Environment.MEDIA_MOUNTED_READ_ONLY.equals(state)) {
                  return true;
              }
              return false;
          }

          private static Cursor query(ContentResolver resolver, Uri uri,
                  String[] projection, String selection, String[] selectionArgs,
                  String sortOrder) {
              try {
                  if (resolver == null) {
                      return null;
                  }
                  return resolver.query(
                          uri, projection, selection, selectionArgs, sortOrder);
               } catch (UnsupportedOperationException ex) {
                  return null;
              }

          }

          public static boolean isMediaScannerScanning(ContentResolver cr) {
              boolean result = false;
              Cursor cursor = query(cr, MediaStore.getMediaScannerUri(),
                      new String [] {MediaStore.MEDIA_SCANNER_VOLUME},
                      null, null, null);
              if (cursor != null) {
                  if (cursor.getCount() == 1) {
                      cursor.moveToFirst();
                      result = "external".equals(cursor.getString(0));
                  }
                  cursor.close();
              }

              return result;
          }

          public static String getLastImageThumbPath() {
              return Environment.getExternalStorageDirectory().toString() +
                     "/DCIM/.thumbnails/image_last_thumb";
          }

          public static String getLastVideoThumbPath() {
              return Environment.getExternalStorageDirectory().toString() +
                     "/DCIM/.thumbnails/video_last_thumb";
          }
      }

      //--------------------------------------------------------------------------------------------------------------------

      禁止.thumbnails自動生成

      ~/.thumbnails
      避免生成tumbnails文件夾的方法是在電腦上新建一個txt文件,并把這個文本文件的后綴名.txt去掉,電腦會提示“如果改變文件擴展名,可能導致文件不可用,確實要更改嗎”這樣的提示,點擊確定,把得到的這個文件拷貝到TF卡的根目錄,在安卓系統下將這個文件重命名為.nomedia(注意!nomedia單詞前面有一個".")因windows系統不支持新建.與_開頭的文件,所以重命名必須在WM系統下進行。按照以上步驟,DCIM文件夾下就不會再生成tumbnails文件夾。
      ~/.thumbnails
      你打開看這個文件夾,是不是很奇怪。有好多你瀏覽過的圖片,包括u盤等移動介質。還有預覽的圖片也在其中,隨著時間可能達到1~2G
      有些個人隱私,也跑這個文件夾中了。比如我喜歡使用 ecryptfs-ulit 一個商用級別(免費)的加密數據層。這下也白干了。
      所以要對付它。刪除它是不可能的,有些程序會自動生成它作為臨時文件夾??墒菂s忘了刪它……
      /tmp是系統指定的臨時文件夾,有個很好的特性——關閉系統會自動清空遮這個文件夾。
      當然我把它扔到內存中,更保護硬盤。那只要啟動前把/tmp 指定為tmpfs文件系統即可
      把.thumbnails 刪除了。復制/tmp文件夾 作為鏈接到~目錄,命名為.thumbnails

      posted @ 2012-05-07 16:51  日光之下無新事  閱讀(12018)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 九九热在线精品视频九九| 精品亚洲欧美高清不卡高清 | 中文字幕亚洲综合久久| 亚洲欧洲一区二区福利片| 亚洲综合伊人久久大杳蕉| 日本一区二区三区专线| 日韩区二区三区中文字幕| 五月婷之久久综合丝袜美腿| 无码人妻丰满熟妇片毛片| 男女啪啪高清无遮挡免费| 九九热视频在线观看视频| 一区二区国产精品精华液| 一个人看的www视频免费观看| 91午夜福利一区二区三区| 亚洲伊人久久精品影院| 亚洲精品乱码久久久久久| 国产午夜福利不卡在线观看| 日韩av综合免费在线| 999精品全免费观看视频| 亚洲熟妇色xxxxx欧美老妇| 亚洲国产精品男人的天堂| 99国产精品永久免费视频| 国产一级r片内射免费视频| 亚洲精品中文综合第一页| 精品久久久中文字幕一区| 欧洲免费一区二区三区视频| 亚洲高清国产自产拍av| 国产精品鲁鲁鲁| 久久中文字幕一区二区| 精品国产不卡在线观看免费| 最近最好的2019中文| 亚洲成人av综合一区| 亚洲综合在线亚洲优优色| 中文一区二区视频| 国产色a在线观看| 亚洲自在精品网久久一区| 亚洲av片在线免费观看| 国产免费高清69式视频在线观看| 亚洲欧洲∨国产一区二区三区| 十八禁午夜福利免费网站| 乐都县|