• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps display listview from database

Thanks hvsent. I'm using MySQl which queries using a php script and then outputs Json. It then puts the Json into a hash map. If I already have the data in a hash map would I then iterate through it and use a case statement to choose a custom view? If so where should I put that logic? In the onCreate function or elsewhere?

Here you go, this should get you off in the right path.
http://www.journaldev.com/10416/android-listview-with-custom-adapter-example-tutorial
I don't know how to change the row based off content of the item. I would guess to use a switch statement and a identifier so you can check the id and then adjust the layout based off the id programatically.
Here you go, this should get you off in the right path.
http://www.journaldev.com/10416/android-listview-with-custom-adapter-example-tutorial
I don't know how to change the row based off content of the item. I would guess to use a switch statement and a identifier so you can check the id and then adjust the layout based off the id programatically.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones