怎么在我设计的应用程序中取得SDcard中的图片
/* 装载资源 */
//mBitQQ = ((BitmapDrawable) getResources().getDrawable(R.drawable.a)).getBitmap(); /* 得到图片的宽度和高度 */
BitQQwidth = mBitQQ.getWidth();
BitQQheight = mBitQQ.getHeight();
我不想用R.drawable.a,我想取得SDcard中的图片,怎么办???
对图片修改后,怎么在存入SDcard中??????????????????
/* 装载资源 */
//mBitQQ = ((BitmapDrawable) getResources().getDrawable(R.drawable.a)).getBitmap(); /* 得到图片的宽度和高度 */
BitQQwidth = mBitQQ.getWidth();
BitQQheight = mBitQQ.getHeight();
我不想用R.drawable.a,我想取得SDcard中的图片,怎么办???
对图片修改后,怎么在存入SDcard中??????????????????
解决方案 »
- 如何扫描手机图片,以文件夹方式分开显示
- 关于LocalServerSocket和LocalSocket
- ExpandableListView 为什么我的getChildView只执行一次
- 如何将pdfview.apk嵌入到自己android程序里
- android 获取平板电脑序列号
- 【求助】关于用SkCanvas绘制SkBitmap的问题
- 问下overlay系统几个类名字的含义
- android2.2如何退出整个应用
- Android系统优化,越优越慢???
- 腾讯微博开放平台的小项目 关于OAUTH授权
- 怎么从Garrely中获取图片,在新的Activity中打开
- MediaPlayer同步播放问题
/* 装载资源 */
//mBitQQ = ((BitmapDrawable) getResources().getDrawable(R.drawable.a)).getBitmap();/* 得到图片的宽度和高度 */
BitQQwidth = mBitQQ.getWidth();
BitQQheight = mBitQQ.getHeight();我不想用R.drawable.a,我想取得SDcard中的图片,怎么办???
我要装载的是SD卡中的图片
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();
}
}
Bitmap bmp= BitmapFactory.decodeStream(fis);
//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();
谢了,怎么不对呀
File bos=new File("/sdcard/")
//把图片存入你创建的bos文件中
bitmap.compress(Bitmap.CompressFormat.jpfg,100,bos);
bos.flush;
bos.close;