gianlazz/Cogneat

Show Test DB tables along with ThoughtLog table, sorted by date in LogHistoryActivity

Closed this issue · 6 comments

Show Test DB tables along with ThoughtLog table, sorted by date in LogHistoryActivity

http://stackoverflow.com/questions/3557972/how-can-i-get-sqlite-to-sort-by-date-properly-using-yyyy-mm-dd-format

"SQLite does not have built-in date fields; you have to use TEXT (textual representation), INTEGER (unix time) or REAL. See: Datatypes in SQLite.

You can use leading zeroes (as dan suggested) or better yet, save them as UNIX timestamps in INTEGER fields. You can convert these back to human-readable dates using SQLite's date and time functions or Java's (or whatever you are using)."

http://stackoverflow.com/questions/25421962/how-to-get-2-tables-in-1-cursoradapter

"I think you need to read and learn more about SQL. It's possible to create a SQL query using SELECT on more than one table such as SELECT TABLE_1.column_A, TABLE_2.column_X. You can also use the SQL JOIN to join multiple queries and columns of tables (although that's somewhat more complicated). The problem with the Android helper methods is they are restrictive often to only one table. There is however a method rawQuery which allows using a SQL query as complicated as you like. –"

https://developer.android.com/reference/android/database/MergeCursor.html

Instead changed the list view to each table