zoukankan      html  css  js  c++  java
  • 采用contentprivider扫描手机SD卡的图片资源

    Intent inten = new Intent(
                        Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
                startActivityForResult(inten,21);
    
    
    
    
    ------------------------在onActivityResult中加入-------------------
    
    
    Uri uri = data.getData();
                String[] filePath = { MediaStore.Images.Media.DATA };
                Cursor c = getContentResolver().query(uri, filePath,
                        null, null, null);
                c.moveToFirst();
                int columnIndex = c.getColumnIndex(filePath[0]);
                Log.e("autobot", columnIndex+"");
                String picturePath = c.getString(columnIndex);
                Log.e("autobot", picturePath);
                c.close();
                Bitmap  bitmap = ImageManager.decodeScaledBitmap(picturePath, 400, 200);
                image.setImageBitmap(bitmap);
  • 相关阅读:
    progresql
    postgresql
    postgresql
    postgresql 索引
    postgresql 视图
    postgresql 触发器
    postgresql异常快速定位
    postgresql数据库备份和恢复
    amgular $q用法
    安装fcitx
  • 原文地址:https://www.cnblogs.com/linximeng/p/3745319.html
Copyright © 2011-2022 走看看