Hi,
TASK on hand:
1. Provide user ability to pick a graphic from either the SD card or
capture one using camera
2. Get the byte[] of the selected image and save it in SQLIte DB along
with the record it is linked to in the application.

Accomplished so far:
1. I have created a custom dialog for user to indicate if he intends
to pick the image from SD card or want to click a snap.
2. Currently working on first option: Choose from SD Card
3. I use the following code to start INTENT

Code:
public void onClick(View v) {
                  // TODO Auto-generated method stub
                  int requestCode = 1;
                  Intent i = new Intent(Intent.ACTION_PICK);
 
i.setData(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
                  startActivityForResult(i, requestCode);
                  dialog.cancel();
               }

4. On picking a graphic the control returns to
Code:
public void onActivityResult(int requestCode, int resultCode, Intent
outputIntent){...}

5. Now when i try to get byte[] of the selected graphic like below:

Code:
                //Proceed to fetch the image and store it in DB
                Uri selectedUri = outputIntent.getData();
                //the output of the above statement from logs
"URI:content://media/external/images/media/1"

               Cursor c =
activity.getContentResolver().query(selectedUri, null, null, null,
null);
                Bitmap img =
BitmapFactory.decodeByteArray(c.getBlob(1), 0, data.length, null);


The img object is always NULL. I am stuck with this for a while now.
Any help is appreciated.

I also have the following questsions:
I was able to get the column indices of the cursor and column names,
but how do i get the type of each column? I ask this because the
c.getBlob() might not be the right choice in my case....!!!

Thanks
Hari
(CTIS)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to