Listview Scroll to the end of the list after updating the list

The question:

I would like to make sure that the list is scrolled all the way to the bottom, after I have updated the listview by using listAdapter, so that it displays the last element entered in the list. How can I do this ?

I tried this but no luck:


thank you

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

Supposing you know when the list data has changed, you can manually tell the list to scroll to the bottom by setting the list selection to the last row. Something like:

private void scrollMyListViewToBottom() { Runnable() {
        public void run() {
            // Select the last row so it will scroll into view...
            myListView.setSelection(myListAdapter.getCount() - 1);

Method 2

You need to use these parameters in your list view:

  • Scroll

  • Set the head of the list to it bottom

You can also set these parameters in XML, eg. like this:

   android:stackFromBottom="true" />

Method 3

A combination of TRANSCRIPT_MODE_ALWAYS_SCROLL and setSelection made it work for me

ChatAdapter adapter = new ChatAdapter(this);

ListView lv = (ListView) findViewById(;

adapter.registerDataSetObserver(new DataSetObserver() {
    public void onChanged() {
        lv.setSelection(adapter.getCount() - 1);    

Method 4

I’ve had success using this in response to a button click, so I guess that you can use it too after updating your contents:

myListView.smoothScrollToPosition(theListAdapter.getCount() -1);

Method 5

To get this in a ListFragment:


Added this answer because if someone do a google search for same problem with ListFragment he just finds this..


Method 6

Using :
Set the head of the list to it bottom lv.setStackFromBottom(true);

Worked for me and the list is scrolled to the bottom automatically when it is first brought into visibility. The list then scrolls as it should with TRANSCRIPT_MODE_ALWAYS_SCROLL.

Method 7

I use


to add entries at the bottom, and older entries scroll off the top, like a chat transcript

Method 8

The simplest solution is :


Method 9

The transcript mode is what you want and is used by Google Talk and the SMS/MMS application. Are you correctly calling notifyDatasetChanged() on your adapter when you add items?

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment