Note that there are some explanatory texts on larger screens.

plurals
  1. POImage setting Gallery view in android
    primarykey
    data
    text
    <p>How can we switch the pictures with some information? When we switch the picture then information should also be get switched in Gallery view in android.</p> <pre><code> public class ImageAdapter extends BaseAdapter { String[] Merchantname=null,Cardname=null,Points=null,Expirydate=null,status=null; private Context ctx; int imageBackground; Bitmap[] image_data; public ImageAdapter(Context c, Bitmap []card_image,String [] Merchantname,String [] Cardname,String []points,String[] Expirydate, String []status) { ctx = c; image_data = card_image; TypedArray ta = obtainStyledAttributes(R.styleable.Gallery1); imageBackground = ta.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 1); ta.recycle(); this.Merchantname=Merchantname; this.Cardname=Cardname; this.Points=points; this.Expirydate=Expirydate; this.status=status; } public int getCount() { return image_data.length; } public Object getItem(int arg0) { return arg0; } public long getItemId(int arg0) { return arg0; } public View getView(int position, View arg1, ViewGroup arg2) { TextView tv1,tv2,tv3,tv4,tv5; ImageView i ;//= new ImageView(this.ctx); if (arg1 == null) { i = new ImageView(this.ctx); } else { i = (ImageView) arg1; } tv1=(TextView)findViewById(R.id.Merchantname); tv2=(TextView)findViewById(R.id.Cardname); tv3=(TextView)findViewById(R.id.Expirydate); tv4=(TextView)findViewById(R.id.status); tv1.setText(Merchantname[position]); tv2.setText(Cardname[position]); tv3.setText(Expirydate[position]); tv4.setText(status[position]); // ImageView iv = new ImageView(ctx); // Drawable drawable = new BitmapDrawable(getResources(), image_data[position]); i.setImageBitmap(image_data[position]); i.setImageDrawable(new BitmapDrawable(getResources(), image_data[position])); i.setScaleType(ImageView.ScaleType.FIT_XY); i.setLayoutParams(new Gallery.LayoutParams(300,200)); i.setBackgroundResource(imageBackground); return i; } } </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.
 

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