@Override protected Cursor getCursorForDeletedTable(ContentProvider cp, Class entryClass) { if (entryClass != EventEntry.class) { throw new IllegalArgumentException("unexpected entry class, " + entryClass.getName()); } return cp.query(Calendar.Events.DELETED_CONTENT_URI, null, null, null, null); }
// // String // public static String getString(ContentProvider provider, Uri uri, String key) { String value = ""; Cursor cur = provider.query(uri, null, null, null, null); if (cur != null) { value = getString(cur, key); cur.close(); } return value; }
// // Boolean // public static Boolean getBoolean(ContentProvider provider, Uri uri, String key) { Boolean value = false; Cursor cur = provider.query(uri, null, null, null, null); if (cur != null) { value = getBoolean(cur, key); cur.close(); } return value; }
// // Int // public static int getInt(ContentProvider provider, Uri uri, String key) { int value = -1; Cursor cur = provider.query(uri, null, null, null, null); if (cur != null) { value = getInt(cur, key); cur.close(); } return value; }
// NOTE: active commands (query, delete, ..) are called to try to // invoke provider code. Real access happens in the Client code // and we need to conntect the Android ContentProviderClient with this..... @DSVerified @DSBan(DSCat.DROIDSAFE_INTERNAL) public static void modelContentProvider(android.content.ContentProvider contentProvider) { contentProvider.droidsafeAttachContext(context); contentProvider.onCreate(); contentProvider.onConfigurationChanged(new Configuration()); contentProvider.onLowMemory(); contentProvider.onTrimMemory(0); // Its not clear if we could figure out some of the value for these parameters contentProvider.query(null, null, null, null, null); contentProvider.insert(null, null); contentProvider.update(null, null, null, null); contentProvider.delete(null, null, null); contentProvider.getType(null); }
// // GeoPoint // public static GeoPoint getPoint( ContentProvider provider, Uri uri, String latKeyE6, String longKeyE6) { int latE6 = 0; int longE6 = 0; Cursor cur = provider.query(uri, null, null, null, null); if (cur != null) { if (cur.moveToNext()) { latE6 = cur.getInt(cur.getColumnIndex(latKeyE6)); longE6 = cur.getInt(cur.getColumnIndex(longKeyE6)); } cur.close(); } return new GeoPoint(latE6, longE6); }