zoukankan      html  css  js  c++  java
  • 相册选择照片

     1         switch (requestCode) {
     2         case REQUEST_FROM_ALBUM:
     3             Uri uri = data.getData();
     4             String path = Utils.getImageAbsolutePath(FeedBackActivity.this, uri);
     5             Logger.d(Const.Tag_Log, "path:" + path);
     6             if (path != null) {
     7                 File file = new File(path);
     8                 if (file != null) {
     9                     Logger.d(Const.Tag_Log, "fileLen:" + file.length());
    10                 }
    11             }
    12 
    13             Bitmap photo = null;
    14             try {
    15                 photo = MediaStore.Images.Media.getBitmap(getContentResolver(), uri);
    16             } catch (FileNotFoundException e) {
    17                 e.printStackTrace();
    18             } catch (IOException e) {
    19                 e.printStackTrace();
    20             }
    21             if (photo != null) {
    22                 // TODO 缩放
    23                 // //为防止原始图片过大导致内存溢出,这里先缩小原图显示,然后释放原始Bitmap占用的内存
    24                 // Bitmap smallBitmap = ImageTools.zoomBitmap(photo,
    25                 // photo.getWidth() / SCALE, photo.getHeight() / SCALE);
    26                 // //释放原始图片占用的内存,防止out of memory异常发生
    27                 // photo.recycle();
    28 
    29                 mIv.setImageBitmap(photo);
    30             }
    31             break;
    32 
    33         default:
    34             break;
    35         }
  • 相关阅读:
    hdu3829(最大独立集)
    hdu2444(判二分图+最大匹配)
    hdu2063+hdu1083(最大匹配数)
    hdu3622(二分+two-sat)
    poj3678(two-sat)
    hdu1824(two-sat)
    hdu3062(two-sat)
    POJ1067 取石子游戏
    POJ1066 Treasure Hunt
    POJ1065 Wooden Sticks
  • 原文地址:https://www.cnblogs.com/jinglecode/p/6676528.html
Copyright © 2011-2022 走看看