swananda

Lurker
Sep 5, 2011
1
0
5
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
 
What is the error you are getting? Can you log what the URI (selectedImageUri) is that is returned to you?

Also the Xoom has no (built in) Sdcard, but that doesn't look to be causing your problem. Support for the Moto Xoom's Sdcard slot was only added in 3.1 or 3.2 I believe also. It's an odd special case.