Hello, I have following problem:
I am creating ListAdapter that is used by my ListView. Task (that I am solving using ListView) relates to displaying files on SD card. When specific directory is opened, list highlights the first item in it and selects the item (using setSelection(position) method of ListView ). Problem appears only at following case: 1. Initial directory contains about 25 files (displayed on screen only 1-5), the first item is selected (0 position) 2. Second directory contains only 1 file. 3. Now we go back to initial directory (don't know why, but ListView displays 21-25), the first item is selected (0 position), but it is not visible (but highlighted, according to logs and what I see after scrolling). Scroll bar in this case is set to the max position. To update list content I use method mListAdapter.notifyDataSetChanged(); It works fine, but with some issues concerning item selection if list's item count is bigger than item's count possible for displaying on the screen. I can resolve this trouble using following set of operations: getListView().setAdapter(null); updateFileList(); mListAdapter.notifyDataSetChanged(); getListView().setAdapter(mListAdapter); Can anybody advice me how to do the right way in this case? Thanks, Lyubomyr --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---