Hello,
I am developing an application that will access the device SDCard to select a picture and the selected picture will be shown in a bitmap view in the application itself.
My code is working well in android 2.1Update, but the same code is crashing in Android 3.0 in Motorola XOOM while accessing the SDCard:
My Code follows:
private static final int PICK_IMAGE=1;
startActivityForResult(Intent.createChooser(imagePicker,"Select Pictute"), PICK_IMAGE);
protected void onActivityResult(int requestCode,int resultCode,Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE)
if (resultCode == Activity.RESULT_OK){
Uri selectedImageUri = data.getData();
if(selectedImageUri!=null){
try{
ContentResolver cr=getContentResolver();
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImageUri);
imgView =(ImageView)findViewById(R.id.imageView);
imgView.setImageBitmap(bitmap);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
If somebody could please help in this.
Regards
Swananda
I am developing an application that will access the device SDCard to select a picture and the selected picture will be shown in a bitmap view in the application itself.
My code is working well in android 2.1Update, but the same code is crashing in Android 3.0 in Motorola XOOM while accessing the SDCard:
My Code follows:
private static final int PICK_IMAGE=1;
startActivityForResult(Intent.createChooser(imagePicker,"Select Pictute"), PICK_IMAGE);
protected void onActivityResult(int requestCode,int resultCode,Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_IMAGE)
if (resultCode == Activity.RESULT_OK){
Uri selectedImageUri = data.getData();
if(selectedImageUri!=null){
try{
ContentResolver cr=getContentResolver();
bitmap = android.provider.MediaStore.Images.Media.getBitmap(cr, selectedImageUri);
imgView =(ImageView)findViewById(R.id.imageView);
imgView.setImageBitmap(bitmap);
}
catch (Exception e) {
e.printStackTrace();
}
}
}
}
If somebody could please help in this.
Regards
Swananda