triple-t / simpleprovider Goto Github PK
View Code? Open in Web Editor NEWA simple way to write ContentProviders and SQL Databases for Android Apps
Home Page: http://triple-t.github.io/simpleprovider/
License: MIT License
A simple way to write ContentProviders and SQL Databases for Android Apps
Home Page: http://triple-t.github.io/simpleprovider/
License: MIT License
it's required min sdk 15
i want 14
and is there any way to use it with gradle instead of maven?
thanks
android.app.ActivityThread.handleBindApplication(ActivityThread.java:5954)
android.app.ActivityThread.access$1200(ActivityThread.java:200)
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1673)
android.os.Handler.dispatchMessage(Handler.java:106)
android.os.Looper.loop(Looper.java:201)
android.app.ActivityThread.main(ActivityThread.java:6810)
java.lang.reflect.Method.invoke(Native Method)
com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:873)
I have already tried setting WAL mode to enable and disable still facing the issue.
Here is the code which I have used in our project
public static DatabaseProvider sDatabaseProvider;
public static DatabaseProvider getInstance(Context context) {
if (sDatabaseProvider == null) {
synchronized (DatabaseProvider.class) {
if (sDatabaseProvider == null) {
sDatabaseProvider = new DatabaseProvider();
}
}
}
return sDatabaseProvider;
}
// For enabling and disabling the WAL by increasing the database version so I can get the logs.
@Override
protected void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// to enable VAL setting
// db.enableWriteAheadLogging();
// to disable VAL setting
db.disableWriteAheadLogging();
// And for testing val setting I have verified using
// to check WAL settings.
boolean isWriteAheadLoggingEnabled = db.isWriteAheadLoggingEnabled();
}
I have already upgraded the to 1.1.0 which is the latest one.
// com.github.triplet.simpleprovider:simpleprovider:1.1.0
Is there any solution for such kind of crashes? Thanks in advanced
Application crashes when proguard is enabled in release build variant.
I created fork of library (https://github.com/mbajor/simpleprovider)
and added commit (https://github.com/mbajor/simpleprovider/commit/c109dc0c1f79edfaa0e5269af05ae7f0e3329170) to provide investigation of the issue by using simpleprovider-sample app.
Before run, uninstall simpleprovider-sample or clear app data.
There is stack trace of simpleprovider-sample (release + proguard).
07-29 12:16:19.070 12680-12720/? E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: android.database.sqlite.SQLiteException: no such table: posts (code 1): , while compiling: SELECT * FROM posts
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1118)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:691)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:44)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1436)
at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1283)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1154)
at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1360)
at de.triplet.simpleprovider.e.a(Unknown Source)
at de.triplet.simpleprovider.e.a(Unknown Source)
at de.triplet.simpleprovider.a.query(Unknown Source)
at android.content.ContentProvider.query(ContentProvider.java:744)
at android.content.ContentProvider$Transport.query(ContentProvider.java:199)
at android.content.ContentResolver.query(ContentResolver.java:417)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:65)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:43)
at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:303)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:68)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:56)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Hi there,
I was wondering what's the name of the Database simpleprovider creates, as i can't find it in the Docs. I have to override the query()-Method for In-App Search, so I can't rely on the Cursor returned by LoaderManager.
Many thanks in advance!
How can we store Image in the ContentProvider. I tried this, but not working
@Column(Column.FieldType.BLOB)
public static final String IMAGE = "image"; //objectId
The title says it all. I would like to define REAL columns to store timestamps in milliseconds (long).
I noticed something. If I drop a Table when I implement Logout in my app and come back in, the data is stored, but it can't be accessible unless I quit the app and then open it again. Do you know what might be the cause. I tried to log that the data is being stored and I noticed it's. But, then why isn't getting accessible on first try?
When I use the code as given in the example in my own project, I see an error on startup because a table does not exist:
Caused by: android.database.sqlite.SQLiteException: no such table: journeys (code 1): , while compiling: SELECT * FROM journeys
My provider looks like this:
public class JourneyProvider extends AbstractProvider {
private static final int SCHEMA_VERSION = 1;
protected String getAuthority() {
return getContext().getString(R.string.authority);
}
@Table
public class Journey {
@Column(Column.FieldType.INTEGER)
public static final String KEY_ID = "_id";
@Column(Column.FieldType.TEXT)
public static final String KEY_TITLE = "title";
}
@Override
protected int getSchemaVersion() {
return SCHEMA_VERSION;
}
}
Please do not make the onCreate method final so I can override it to allow creation of views.
I would to:
public boolean onCreate() {
super.onCreate();
//mDatabase.createView...
}
Thanks.
I think it should be possible to upgrade to Robolectric 2.3. The only problem is that travis does not find the support library 19.0.1. This can be fixed by manually installing extra-android-m2repository
before we build it. In contrast, 2.2 uses support library v7 which is on central and thus can be found during the build.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.