• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Need help on accessing SDCard in Motorola XOOM

swananda

Lurker
Sep 5, 2011
1
0
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
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones