rphello101 rphello101 - 11 months ago 61
Android Question

Display new items at the top of a ListView

I'm using a list to populate a ListView (). The user is able to add items to the list. However, I need the items to be displayed at the top of the ListView. How do I insert an item at the beginning of my list in order to display it in reverse order?


You should probably use an ArrayAdapter and use the insert(T, int) method.


ListView lv = new ListView(context);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(context, R.id...);
adapter.insert("Hello", 0);