I know this question is asked several times before but my situation is bit different from other questions.
I have a listview and initially i want to set the scroll position to the bottom of the list.
I have try 2 ways.
1st one
mCommentListView.setSelection(mAdaptor.getCount()-1);
2nd one
mCommentListView.post(new Runnable() {
@Override
public void run() {
mCommentListView.setSelection(mAdaptor.getCount()-1);
}
});
So my problem is both of above code working properly with the emulator but it is not working with the real device.
What have i missed?
try this. the below code is working fine for me.
give time delay 500 for load listview then call setselection method.
commentslistview.postDelayed(new Runnable() {
@Override
public void run() {
commentslistview.setSelection(commentsarraylist.size());
}
}, 500);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With