How to check if a table exists in Android?

I am trying to execute a query on a dormpolicy table

 String operatorName = "46001"; String selection = "(plmn = '"+operatorName+"')"; URI CONTENT_URI_DORMPOLICY = Uri.parse("content://nwkinfo/nwkinfo/dormpolicy"); cursor = phone.getContext.getContentResolver().query(CONTENT_URI_DORMPOLICY, null, selection, null, null); 

I get an error log:

  SQLiteQuery: exception: no such table: dormpolicy; query: SELECT * FROM dormpolicy WHERE ((plmn = '46001')) 

This problem does not always happen on my phone.

It seems like sometimes when I access the table before creating the table.

Is there a way that before I query a table, check if the table exists?

But as?

+4
source share
1 answer

My answer is twofold:

+3
source

All Articles