If you think the Android project image-loader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.novoda.imageloader.demo.provider;
/*fromwww.java2s.com*/import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.util.Log;
publicclass ImageLoaderDemoProvider extends ContentProvider {
private CustomUriMatcher matcher = new CustomUriMatcher();
private DatabaseManager databaseManager;
private SQLiteDatabase database;
protected SQLiteDatabase getDataBase() {
if (database == null) {
databaseManager = new DatabaseManager(getContext());
database = databaseManager.getWritableDatabase();
}
return database;
}
@Override
public String getType(Uri uri) {
String type = null;
switch (matcher.match(uri)) {
case CustomUriMatcher.IMAGE_INCOMING_COLLECTION: {
type = CustomUriMatcher.IMAGE_COLLECTION_TYPE;
break;
}
case CustomUriMatcher.IMAGE_BIGIMAGES_INCOMING_COLLECTION: {
type = CustomUriMatcher.IMAGE_BIGIMAGES_COLLECTION_TYPE;
break;
}
default: {
Log.e("ImageLoader", "Problem with query, not Implemented for : " + uri);
thrownew RuntimeException("Problem with query, not Implemented for : " + uri);
}
}
return type;
}
@Override
publicboolean onCreate() {
return false;
}
@Override
publicint delete(Uri arg0, String arg1, String[] arg2) {
return 0;
}
@Override
public Uri insert(Uri arg0, ContentValues arg1) {
return null;
}
@Override
public Cursor query(Uri uri, String[] p, String s, String[] args, String o) {
String n = uri.getLastPathSegment();
return getDataBase().query(n, p, s, args, null, null, o);
}
@Override
publicint update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
return 0;
}
}