I need some help, i am using a viewholder to display from a dynamic arrayadapter.
I have list view .
Each row contains ;
- Title (Textview),
- sub title(TextView),
- Progress bar
- Download Button (Button).
I want to show progress bar and hide Download Button when Download Button is clicked. When download button in first row clicked, first progress bar is showing but 8th progress bar is showing too.
This is my code. what i am doing wrong?
public class TabInComingAdaptor extends BaseAdapter {
public static class ViewHolder {
TextView title;
TextView desc;
Button DownloadButton;
ProgressBar pB;
}
private ArrayList<rowObject> data;
private LayoutInflater inflater = null;
private Application ap;
// final private Activity currentActivity;
Button progressButton1;
int CurrentUser;
public TabInComingAdaptor(Activity activity, Application application,
ArrayList<rowObject> GelenFakslar) {
// currentActivity = activity;
ap = application;
data = GelenFakslar;
inflater = (LayoutInflater) ap
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public int getCount() {
return data.size();
}
public Object getItem(int position) {
return position;
}
public long getItemId(int position) {
return position;
}
public View getView(final int position, View vi, ViewGroup parent) {
ViewHolder viewHolder;
if (vi == null) {
vi = inflater.inflate(R.layout.tab_incoming_row, parent, false);
viewHolder = new ViewHolder();
viewHolder.title = (TextView) vi.findViewById(R.id.RowTitle);
viewHolder.desc = (TextView) vi.findViewById(R.id.RowDesc);
viewHolder.DownloadButton = (Button) vi
.findViewById(R.id.RowDownloadButton);
viewHolder.pB = (ProgressBar) vi
.findViewById(R.id.RowDownloadProgress);
viewHolder.DownloadButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
LinearLayout vwParentRow = (LinearLayout) v.getParent();
v.setVisibility(View.GONE);
ProgressBar zxcv = (ProgressBar) vwParentRow.getChildAt(0);
zxcv.setVisibility(View.VISIBLE);
vwParentRow.refreshDrawableState();
}
});
vi.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) vi.getTag();
}
viewHolder.title.setText(data.get(position).getBaslik());
viewHolder.desc.setText(data.get(position).getTarih());
return vi;
}
}