Is there a nice way in Android to see if a column exists in a table in the application database? (I know there are questions similar to this one already, but there don’t seem to be any that are Android specific.)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
cursor.getColumnIndex(String columnName)returns -1 if, the column doesn’t exist. So I would basically perform a simple query like “SELECT * FROM xxx LIMIT 0,1” and use the cursor to determine if the column, you are looking for, existsOR
you can try to query the column “SELECT theCol FROM xxx” and catch an exception