Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to retrieve imagepath from arraylist & display them in gridview?
    primarykey
    data
    text
    <p>I have taken the two different paths of images are stored in sdcard.I want to display the both images in gridview.Can you please help me?The main problem is that if i am using arraylist of integer type and giving the ids of image than i can see the image but if i am using the arraylist of string type which have the path of image than how to show the image. i also commented over the line where to change,please help me??</p> <pre><code> public class ImageAdapter extends BaseAdapter { private Context mContext; public ImageAdapter(Context c) { mContext = c; } public int getCount() { return mThumbIds.length; } public Object getItem(int position) { return null; } public long getItemId(int position) { return 0; } // create a new ImageView for each item referenced by the Adapter public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some attributes imageView = new ImageView(mContext); imageView.setLayoutParams(new GridView.LayoutParams(85, 85)); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setPadding(8, 8, 8, 8); } else { imageView = (ImageView) convertView; } //here i am getting problem tell me how to use path of image in arraylist imageView.setImageResource(mThumbIds[position]); return imageView; } // references to our images ArrayList&lt;String&gt; mThumbIds=new ArrayList&lt;String&gt;; mThumbIds.add("/mnt/sdcard/a.jpg"); mThumbIds.add("/mnt/sdcard/b.jpg"); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload