samedi 9 mai 2015

Adnroid Add view to listAdapter item(layout)

I tried to add view by passing the view to function and add it to layout but it doesn't work.

Important Information: I add the view to ListAdapter item, and the layout that I tried to addView on it is an Item in the listAdapter.

Problem: the view has parent I don't know from where.

I got error say that the view has a parent and I should to remove the view first."

Examp:

EditView ed1=new EditView(context)
ed1.setText("TEST VIEW");
myObject.addViewToAdapter(ed1,index);

when the adapter fill values to items and reach to the specific index should add view on the current item(layout).

Question:

  • from where this view take the parent and why I cant use it in other layout?
  • what object I should to remove the view from it to add it to another layout?
  • what is the right way I should to use it in my case to avoid this error?

Aucun commentaire:

Enregistrer un commentaire