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

