An easy way of doing that parsing is shown below.
Uri uri=getContentResolver().insert(ProviderHelper.determineURI(myCarObj), myCarObj.createContentValues());
Log
String carId = uri.getPathSegments().get(1);
Log.d(TAG, "Content inserted at: " + uri);
Log.d(TAG, "Car_id: " + carId);
05-24 13:49:41.290: D/CarProviderTest(11228): Content inserted at: content://com.supercar.edc.android.contentproviders.Car/car/123
05-24 13:49:41.290: D/CarProviderTest(11228): Car_id: 123)
123 is the Android Id (_id) for the record I just created.
No comments:
Post a Comment