0

I am an Android Developer.I have to add some more view in the list view on the the position on which user click.For example add two button on the item position on which user click. Is it possible to add views in list with onItemClicklistener I am using this code

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    // TODO Auto-generated method stub
    LayoutInflater inflater=((Activity) getApplicationContext()).getLayoutInflater();

    inflater.inflate(R.layout.row, null);

    Button but=(Button)findViewById(R.id.button1);
    but.setVisibility(0);

}

I have already added button in List view and set its visibility off.Can any body help me any help will be highly appreciable.

Nitin
  • 1,966
  • 4
  • 22
  • 53

1 Answers1

0

u can get the view on which the onItemClickListener was used, and then use view.post() to add new views to the item. I followed this to add extra views dynamically.

http://developer.android.com/reference/android/view/View.html#post(java.lang.Runnable)

Yashwanth Kumar
  • 28,931
  • 15
  • 65
  • 69