Access to a custom ListView item

I am new here, so I hope to follow the recommendations, as I am new to both supporters and Android.

For my first application, I am trying to create a world clock. To check this, the time is displayed and updated in seconds. (00:00:00) The only thing I want to update every second is the time I don't want to use: ListView notfiyDataHasChanged ()

I have a custom ListView and an extended BaseAdapter and row.xml with each list of ListView items.

Attempt: lv.getChildCount () returns 0; Therefore, I understand that he does not have a child. But I do not know how I can get an idea of ​​a specific item in the list. Then call this TextView with findViewById (R.id.time) and set it every second.

I searched googled and read a lot of threads, but still do not understand :(

Thank.

+3
source share
1 answer

I would take a different approach to this problem: subclass the TextView widget into your own TimeView widget and include it in your line layout.

The TimeView widget will have a handle that calls itself to update the view.

Therefore, automatically all the views visible in the list will be updated, other elements of the adapter will not have a view and will not, as a consequence, need to be updated.

0
source

Source: https://habr.com/ru/post/1742518/


All Articles