Problem show image from internal external content

All your problems with Audio, Video and Images.

Problem show image from internal external content

Postby fala70 » Mon Dec 08, 2008 2:04 pm

Hi,

I am going crazy to show a few images from Media.INTERNAL_CONTENT_URI or Media.EXTERNAL_CONTENT_URI.
I need to show a few images from Internal or External memory, using an Activity similar to ImageSwitcher1.java from ApiDemo.

I know if the image is on Internal or External memory and I know also the image name. I modified the getView function of ImageSwitcher1.java so:

public View getView(int position, View convertView, ViewGroup parent) {
ImageView i = new ImageView(mContext);

try{
cur.moveToPosition(position);
Uri ur=null;

if (cur.getInt(7)==1)
ur = Media.INTERNAL_CONTENT_URI;
else
ur = Media.EXTERNAL_CONTENT_URI;
Uri uri=Uri.withAppendedPath(ur, cur.getString(5));
i.setImageURI(uri);
i.setAdjustViewBounds(true);
i.setLayoutParams(new Gallery.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
i.setBackgroundResource(R.drawable.picture_frame);
}
catch(Exception ex){

}
return i;
}


my problem is that is showed correctly ony the first image, then crash.

help please.
thanks
Stefano
fala70
Freshman
Freshman
 
Posts: 3
Joined: Mon Dec 08, 2008 11:49 am

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 13 guests