Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In your case, you can try make your image array a dynamic list, ex: ArrayList. Upon the arrival of new item, add it to the list, and call notifyDataSetChanged() (method of the adapter), and your gallery list will be refreshed. </p> <p>Depends on your case, I found that it is better to use AsyncTask here to update the list, and call notifyDataSetChanged.</p> <p>The adapter class would looks similarly to this</p> <pre><code>public class AddImgAdp extends BaseAdapter { int GalItemBg; ArrayList&lt;Bitmap&gt; bitmapList; private Context cont; public AddImgAdp(Context c, ArrayList&lt;Bitmap&gt; bitmapList) { cont = c; TypedArray typArray = obtainStyledAttributes(R.styleable.GalleryTheme); GalItemBg = typArray.getResourceId(R.styleable.GalleryTheme_android_galleryItemBackground, 0); typArray.recycle(); this.bitmapList = bitmapList; } public int getCount() { return bitmapList.size(); } public Object getItem(int position) { return bitmapList.get(position); } public long getItemId(int position) { return bitmapList.get(position); } public View getView(int position, View convertView, ViewGroup parent) { ImageView imgView = new ImageView(cont); // imgView.setImageResource(Imgid[position]); imgView.setImageBitmap(bitmapList.get(position)); imgView.setLayoutParams(new Gallery.LayoutParams(80, 70)); imgView.setScaleType(ImageView.ScaleType.FIT_XY); imgView.setBackgroundResource(GalItemBg); return imgView; } } </code></pre> <p>Let me know if any errors, I am way to depending on IDE.</p>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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