0

I am having a receiver that broadcast when a intent service finishes a server call,When receiver is broadcast in onReceive I have updated list view with new data. What I want is to set the position of item to last element in a list before the broadcast. I have tried using setSelection() and smoothScrollToPosition(),but the list is focused to first item every time a list is updated.

Dory
  • 7,462
  • 7
  • 33
  • 55

3 Answers3

2

use notifyDataSetChanged() to update list view.

Ravi
  • 707
  • 1
  • 8
  • 18
0

Try this code

     mAdapter.notifyDataSetChanged();

where mAdapter is your Adapter Object which you used to populate data in ListView.it will only update your ListView without focused to first item.

Pankaj Singh
  • 2,241
  • 2
  • 16
  • 16
0

Try this code also

listview.requestLayout(); listview.setSelectionFromTop(listview.getLastVisiblePosition()-20,0);

This make Listview selection from bottom side item

Pranita Patil
  • 791
  • 1
  • 9
  • 16