From: gumartinm Date: Fri, 17 Feb 2012 07:07:54 +0000 (+0100) Subject: Last steps with my provider. X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=0b064015acdd1b8155d93e8dfa9eb69486d71da3;p=JavaForFun Last steps with my provider. It works smoothly. --- diff --git a/Android/Testing/Test3/src/de/android/test3/IndexerProvider.java b/Android/Testing/Test3/src/de/android/test3/IndexerProvider.java index f3abcc9..1dec16c 100644 --- a/Android/Testing/Test3/src/de/android/test3/IndexerProvider.java +++ b/Android/Testing/Test3/src/de/android/test3/IndexerProvider.java @@ -33,6 +33,8 @@ public class IndexerProvider extends ContentProvider { // The incoming URI matches the Note ID URI pattern private static final int INDEXER_ID = 2; + private static final int INDEXER_IDAD = 3; + static { /* @@ -48,6 +50,8 @@ public class IndexerProvider extends ContentProvider { // to a index ID operation sUriMatcher.addURI("de.android.test3.provider", Indexer.Index.TABLE_NAME + "/#", INDEXER_ID); + sUriMatcher.addURI("de.android.test3.provider", Indexer.Index.TABLE_NAME + "/" + Indexer.Index.COLUMN_NAME_ID_AD + "/#", INDEXER_IDAD); + /* * Creates and initializes a projection map that returns all columns @@ -275,7 +279,15 @@ public class IndexerProvider extends ContentProvider { // the position of the note ID itself in the incoming URI uri.getPathSegments().get(1)); break; - + + case INDEXER_IDAD: + qb.setProjectionMap(sIndexerProjectionMap); + qb.appendWhere( + Indexer.Index.COLUMN_NAME_ID_AD + // the name of the ID column + "=" + + // the position of the Advertisement ID itself in the incoming URI + uri.getPathSegments().get(2)); + break; default: // If the URI doesn't match any of the known patterns, throw an exception. throw new IllegalArgumentException("Unknown URI " + uri); diff --git a/Android/Testing/Test3/src/de/android/test3/MobieAdHttpClient.java b/Android/Testing/Test3/src/de/android/test3/MobieAdHttpClient.java index 2f349ee..ad024d7 100644 --- a/Android/Testing/Test3/src/de/android/test3/MobieAdHttpClient.java +++ b/Android/Testing/Test3/src/de/android/test3/MobieAdHttpClient.java @@ -98,9 +98,12 @@ public class MobieAdHttpClient implements Runnable ContentValues values = new ContentValues(); values.put(Indexer.Index.COLUMN_NAME_PATH, "18188181"); values.put(Indexer.Index.COLUMN_NAME_ID_AD, "22"); - Uri probando = Uri.parse("content://" + "de.android.test3.provider" + "/" + "indexer"); - this.context.getContentResolver().insert(probando, values); + Uri probando = Uri.parse("content://" + "de.android.test3.provider" + "/" + "indexer" + "/idad/" + "22"); + Cursor cursor = this.context.getContentResolver().query(probando, null, null, null, null); + if (cursor != null) { + } + //this.context.getContentResolver().insert(probando, values); downloadAds((Integer) objects.get("id"), (String)objects.get("domain"), (String)objects.get("link")); } } catch (URISyntaxException e) {