怎么在我设计的应用程序中取得SDcard中的图片
/* 装载资源 */
//mBitQQ = ((BitmapDrawable) getResources().getDrawable(R.drawable.a)).getBitmap(); /* 得到图片的宽度和高度 */
BitQQwidth = mBitQQ.getWidth();
BitQQheight = mBitQQ.getHeight();

我不想用R.drawable.a,我想取得SDcard中的图片,怎么办???
对图片修改后,怎么在存入SDcard中??????????????????

解决方案 »

  1.   

    输入输出流存咯。路径是Environment.getExternalStorageDirectory().getAbsolutePath()
      

  2.   

    怎么在我设计的应用程序中取得SDcard中的图片
    /* 装载资源 */
    //mBitQQ = ((BitmapDrawable) getResources().getDrawable(R.drawable.a)).getBitmap();/* 得到图片的宽度和高度 */
    BitQQwidth = mBitQQ.getWidth();
    BitQQheight = mBitQQ.getHeight();我不想用R.drawable.a,我想取得SDcard中的图片,怎么办???
    我要装载的是SD卡中的图片
      

  3.   

    保存到sdcard的 public void saveBitmap(Bitmap bmp) throws IOException {
    File f = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/img.png");
    f.createNewFile();
    FileOutputStream fOut = null;
    try {
    fOut = new FileOutputStream(f);
    } catch (FileNotFoundException e) {
    e.printStackTrace();
    }
    bmp.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
    try {
    fOut.flush();
    } catch (IOException e) {
    e.printStackTrace();
    }
    try {
    fOut.close();
    } catch (IOException e) {
    e.printStackTrace();
    }
    }
      

  4.   

    读取图片的,你看我多好,给你复制粘贴。。 FileInputStream fis = new FileInputStream(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/camera.png"));
    Bitmap bmp= BitmapFactory.decodeStream(fis);
      

  5.   

    /* 装载资源 */
    //mBitQQ = ((BitmapDrawable) getResources().getDrawable(R.drawable.icon)).getBitmap();
    FileInputStream fis = new FileInputStream(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/camera.png"));
    Bitmap bmp= BitmapFactory.decodeStream(fis);
    /* 得到图片的宽度和高度 */
    BitQQwidth = mBitQQ.getWidth();
    BitQQheight = mBitQQ.getHeight();

    谢了,怎么不对呀
      

  6.   

    //新建一个文件bos
    File bos=new File("/sdcard/") 
    //把图片存入你创建的bos文件中
    bitmap.compress(Bitmap.CompressFormat.jpfg,100,bos);
    bos.flush;
    bos.close;