1. Are you ready for the Galaxy S20? Here is everything we know so far!

Need help on accessing SDCard in Motorola XOOM

Discussion in 'Android Development' started by swananda, Sep 5, 2011.

  1. swananda

    swananda Lurker
    Thread Starter

    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
     



    1. Download the Forums for Android™ app!


      Download

       
  2. alostpacket

    alostpacket Over Macho Grande?

    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.
     
  3. alostpacket

    alostpacket Over Macho Grande?

    Also welcome to AF! :)
     
Loading...

Share This Page

Loading...