in my app i have a list view. Each list consists of a image, text and three buttons. I have placed all this in a ListActivity.
When the user clicks a particular button i use to call the download function of my app. At that time i want that button to be get invisibled. Following is the part of my code
public class Content extends ListActivity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
adapter = new EventAdapter(this);
setListAdapter(adapter);
}
public class InventoryAdapter extends BaseAdapter implements OnClickListener
{
private Context context;
ImageButton b1;
public InventoryAdapter(Context ctx)
{
context = ctx;
}
public long getItemId(int position)
{
return position;
}
public View getView(int position, View convertView, ViewGroup parent)
{
View view;
if(convertView == null)
{
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.list, null);
b1 = (ImageButton)view.findViewById(R.id.Btn1);
b1.setOnClickListener(this);
}
else
{
view = convertView;
}
b1.setTag(position);
return view;
}
@Override
public void onClick(View v)
{
Log.e("onclick","onclick");
Integer position = (Integer) v.getTag();
switch(v.getId())
{
case R.id.Btn1:
selected_url=url[position];
new DownloadTask1().execute();
break;
}
}
}
How to make the a particular button to get invisibled when the a position is clicked