Note that there are some explanatory texts on larger screens.

plurals
  1. POGallery widget rebind issue
    primarykey
    data
    text
    <p>I am working in an android application. I am using a Gallery widget that I am binding a Imageview and an Imagebutton to that. On the button click I hide one of the buttons in the gallery, but after scrolling and coming back that hidden button becomes again visible. What causes this to happen. Does the gallery bind again after scroll. Please provide any valid link if possible to solve this problem.</p> <p>This is my code:</p> <pre><code>public class ImageAdapter extends BaseAdapter { private int mGalleryItemBackground; private Activity mContext; private Integer[] Images; public ImageAdapter(Activity c,Integer[] images) { this.mContext = c; this.Images=images; TypedArray attr = mContext.obtainStyledAttributes(R.styleable.HelloGal999lery); mGalleryItemBackground = attr.getResourceId( R.styleable.HelloGal999lery_android_galleryItemBackground, 0); attr.recycle(); } public int getCount() { return Images.length; } public Object getItem(int position) { return position; } public long getItemId(int position) { return 1; } public boolean onInterceptTouchEvent(MotionEvent __e) { return false; } public static class ViewHolder{ public ImageView imageView1; public ImageButton btn1; public ProgressBar processdialog; } //Binding image and button to gallery public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; View rowView = convertView; if(rowView==null) { LayoutInflater inflater = mContext.getLayoutInflater(); rowView = inflater.inflate(R.layout.test, null, true); holder=new ViewHolder(); holder.imageView1=(ImageView) rowView.findViewById(R.id.ImageViewuser); holder.btn1=(ImageButton)rowView.findViewById(R.id.Download); holder.processdialog=(ProgressBar)rowView.findViewById(R.id.progressbar_Horizontal); holder.imageView1.setImageResource(Images[position]); holder.imageView1.setScaleType(ImageView.ScaleType.CENTER_INSIDE); holder.imageView1.setBackgroundResource(mGalleryItemBackground); holder.btn1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub //Toast.makeText(mContext, position+"", Toast.LENGTH_SHORT).show(); holder.processdialog.setVisibility(View.VISIBLE); BackgroundAsyncTask dd=new BackgroundAsyncTask(); dd.execute(); } class BackgroundAsyncTask extends AsyncTask&lt;Void, Integer, Void&gt; { int myProgress; @Override protected void onPostExecute(Void result) { // TODO Auto-generated method stub Toast.makeText(mContext, "Download finished", Toast.LENGTH_LONG).show(); holder.processdialog.setVisibility(View.INVISIBLE); holder.btn1.setVisibility(View.VISIBLE); } @Override protected void onPreExecute() { // TODO Auto-generated method stub /* Toast.makeText(mContext, "Downloading", Toast.LENGTH_LONG).show(); myProgress = 0;*/ holder.processdialog.setVisibility(View.VISIBLE); holder.btn1.setVisibility(View.INVISIBLE); } @Override protected Void doInBackground(Void... params) { // TODO Auto-generated method stub while(myProgress&lt;100){ myProgress++; publishProgress(myProgress); SystemClock.sleep(100); holder.btn1.setVisibility(View.INVISIBLE); holder.processdialog.setVisibility(View.VISIBLE); } return null; } @Override protected void onProgressUpdate(Integer... values) { holder.processdialog.setProgress(values[0]); } } }); } return rowView; } </code></pre> <p>Please help me.</p> <p>Thanks in advance.</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.
 

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