I got the MediaStore to give me a cursor of the right size (it's 4
now, since I have 3 downloaded images) but I still cant get the images
to show up. Here is my code :
===============
public View getView(int pos, View convertView, ViewGroup parent) {
try {
ImageView i = new ImageView(mContext);
if (convertView == null) {
cursor.moveToPosition(pos);
int id = cursor.getInt(column_index);
Log.i(tag, Uri.withAppendedPath
(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ""+id).toString());
//i.setImageURI(Uri.withAppendedPath
(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, ""+id));
i.setImageURI(Uri.withAppendedPath
(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, ""+id));
i.setScaleType(ImageView.ScaleType.FIT_XY);
i.setLayoutParams(new
Gallery.LayoutParams(136, 88));
// The preferred Gallery item background
//i.setBackgroundResource(mGalleryItemBackground);
}
return i;
} catch (Exception e) {
Log.e(tag, "Exception: "+e.toString());
return null;
}
}
============
Again, thanks in advance for any help :)
- Moazzam
On Sep 26, 1:04 pm, moazzamk <[email protected]> wrote:
> Hi guys,
>
> I am trying to make an application which will upload pictures to a
> website. I need to let the user browse through the pictures they want
> to upload and select them. However, when I try to use the MediaStore I
> always get an empty cursor.
>
> I created an SD CARD image and used that with the emulator. I know one
> image exists in /sdcard/media. I copied it using an image manipulation
> tool (winimage). And, I can see the image when I use the command "ls /
> sdcard/media" in the terminal application of the phone.
>
> The code I am using is this :
>
> =============
> // Here we set up a string array of the thumbnail ID column
> we want
> to get back
> String [] proj={MediaStore.Images.Thumbnails._ID};
> // Now we create the cursor pointing to the external
> thumbnail store
> cursor = managedQuery
> ( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
> proj, // Which columns to return
> null, // WHERE clause; which rows to
> return (all rows)
> null, // WHERE clause selection
> arguments (none)
> null); // Order-by clause (ascending by name)
> // We now get the column index of the thumbnail id
> Log.i(tag, "size: ");
> Log.i(tag, "size: "+cursor.getCount());
> ==============
>
> Am I missing something here?
>
> Thanks in advance for the help,
>
> Moazzam
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---