问题
Suppose that you have AbcContentProvider which allows you to query/update it with it's content:// url.
Is it possible to see the names/values those can be updated or queried?
(This would be similar to "select * from table_abc" in an sql query or like "Show tables" from a database table)
回答1:
This will help:
Uri u = // your CONTENT_URI
Cursor c = context.getContentResolver(uri, null, null, null, null, null);
Log.d(TAG, "listing column for uri=" + uri);
for (int i = 0; i<c.getColumnCount(); i++) {
    Log.d(TAG, "column " + i + "=" + c.getColumnName(i));
}
If the remote ContentProvider is not accepting a null projection:
- If this is about an android internal ContentProvider: Read the android source code: http://source.android.com/
- If this is about some other app: Decompile it and read the source code: Android - How to decode and decompile any APK file?
- You can brute force the list by querying with single element projection with a list of (random/generated) names
回答2:
have you read Cursor docs? if not: getColumnCount() & getColumnName(idx)
来源:https://stackoverflow.com/questions/18672806/is-there-a-way-to-list-column-names-in-an-undocumented-but-allowed-contentprovid