您好我有这个代码,如何将图像转换为位图?我正在访问图库中的图片。
_GaleryButton.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent=new Intent();
intent.setAction(Intent.ACTION_PICK);
intent.setData(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivity(intent);
}
});
}
protected void onGActivityResult(int GrequestCode, int GresultCode, Intent Gdata){
super.onActivityResult(GrequestCode,GresultCode,Gdata);
Uri uriimg = Gdata.getData();
}
答案 0 :(得分:0)
答案 1 :(得分:0)
如果您想将图像转换为SD卡,请使用此代码
//Get the root of your sd card
File sdcard = Environment.getExternalStorageDirectory();
//Folder from sd card
File storagePath = new File(sdcard.getAbsolutePath() + "/fb_image");
//Decode the file from the folder to bitmap
Bitmap bmp = BitmapFactory.decodeFile(storagePath + "/" + file_name+ ".jpg");