In the application, you need to make a category tree in the ListView .

in mysql:

 categories (id, cat_title, parent_cat_id) 

when selecting an item, request from the server of child categories and update the list.

How to write category id in list_item, invisible TextView with id?

    1 answer 1

    no rating comments to write. (I'm not sure if I understood the question. Do I need to save the item id in the ListView item? If we are talking about "invisible TextView", then we are talking about a custom adapter? I would like to see the code.

    There are different options, someone, for example, gets from the list by position via getItem(int i) or another option:

      MyItem item = ... view.setTag(item); // или просто ид view.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (v.getTag() instanceof MyItem) { MyItem item = (MyItem) v.getTag(); 

    ....