I have a HeaderView in my ListView. On clicking it, it hides the text and shows a spinner to fetch data from somewhere.
I want to disable the onClick after the first click so that he cannot call the fetch multiple times.
I tried v.setClickable(false) and v.setEnabled(false), but none of them worked.
Any ideas?
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
if (position == 0) {
ProgressBar pb = (ProgressBar) v
.findViewById(R.id.refresh_progress);
pb.setVisibility(View.VISIBLE);
TextView tv = (TextView) v.findViewById(R.id.load);
tv.setVisibility(View.GONE);
v.setClickable(false);
DownloadTask dt = new DownloadTask(v, "Old Message");
dt.execute();
}
}
Probably best to just track the fact that you have already done/started a fetch with a member var in your activity and then test it in your OnClick handler