-1

As ContentProviders can use internally database,Is there anyway to check particular table exists or not using content provider URI.

Any related links/code helps me a lot.

Thanks in Advance.

Manju
  • 720
  • 9
  • 23
  • 1
    "As ContentProviders uses internally database" - This isn't true. There's no requirements for a `ContentProvider` to use databases, and I've written them before over `SharedPreferences` or files. They're simply an abstraction layer. – PPartisan Jul 24 '19 at 10:44
  • @PPartisan Thanks for correction. updated the question. – Manju Jul 24 '19 at 13:09

1 Answers1

-1

SQL query for checking if a table exists and doing operations:

IF 

 (EXISTS

  (SELECT * FROM TABLE_NAME)

 )

BEGIN

    --Do Stuff

END

Use this query in a cursor and iterate:

Cursor cursor = contentResolver.query( "Your query here" )

For more info:

Content Provider

dustblue
  • 557
  • 5
  • 14