简体   繁体   中英

Displaying a ListView using SQLite

A part of the project I'm working on is searching about places in a database. The user first chooses a category, then the search criteria and the results should be displayed in a list view in which the items are from the database. Only one works right and the rest don't, even though they have similar code.

The first search category is Hotel s which works perfectly fine, the rest of the categories are not working properly, the methods are correct but displaying the data is wrong, instead of displaying the name it displays packageName.tableName@weirdNumber example( egypt.database.NileCruise@44f40448 ).

By default ArrayAdapter will call the method toString on your object to get a String to show in the list row.

You probably implemented the method toString for the class Hotel but forgot to implement it for the class NileCruise and you end up with the default implementation of toString (that returns what you currently see).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM