Check this error here.
Process: com.example.rockodile.contactsappliaction, PID: 5549
java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
at android.database.CursorWindow.nativeGetString(Native Method)
at android.database.CursorWindow.getString(CursorWindow.java:438)
at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51)
at com.example.rockodile.contactsappliaction.UserSQL.getContactList(UserSQL.java:105)
at com.example.rockodile.contactsappliaction.MainActivity.onClick(MainActivity.java:52)
Update.
public ArrayList<HashMap<String, String>> getContactList() {
//Open connection to read only
SQLiteDatabase db = dbHelper.getReadableDatabase();
String selectQuery = "SELECT " +
Contact.KEY_ID + "," +
Contact.KEY_FORENAME + ", " +
Contact.KEY_SURNAME + ", " +
Contact.KEY_HOUSENUMEBR + ", " +
Contact.KEY_STREET + ", " +
Contact.KEY_TOWN + ", " +
Contact.KEY_COUNTY + ", " +
Contact.KEY_POSTCODE + ", " +
Contact.KEY_PHONE + ", " +
" FROM " + Contact.TABLE;
A comma before from
6
solved Android SQlite exceptions which cause the app to crash [closed]