-1

I'm programming an Android application and one feauture is a ListView generated and populated by a MySQL Database.

This is the outputted ArrayList:

DatabaseHandler db = new DatabaseHandler(this); 
List<Suspect> list = db.getAllContacts();

Do I use a cursor to input it in my ListView? Any code would be appreciated..

1

2 Answers 2

1

I recommend you to use CursorAdapter in case you don't need any data manipulations after the query.
If you want to use List so try ArrayAdapter.

Sign up to request clarification or add additional context in comments.

Comments

1

If you need to modify the data after it is captured from the database and have the view updated I'd suggest you create an arrayList of , and then you can use a custom Array Adapter like shown here. If you then change the underlying data, you can use adapter.notifyDataSetChanged()

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.