Coder Social home page Coder Social logo

android-classcontentprovider's Introduction

Usage:

- import the JAR file of the application
- Create class that extends ClassContentProvider
- Prepare your model
-- Annotate the classes with both @Table and @Authority
-- Annotate the fields with @Column and the primarykey fields with @PrimaryKey. If the field is integer and primarykey you can add @Autoincrement.
- in constructor invoke provideClass for every type of resource you want to expose with the provider.

And it should be done! :)

android-classcontentprovider's People

Contributors

sirmmo avatar

Stargazers

 avatar  avatar

Watchers

 avatar

android-classcontentprovider's Issues

NullPointerException when creating Content Provider

I'm getting a Null Pointer Exception when trying to create a Content Provider.

Logcat:

08-02 11:46:08.191: E/AndroidRuntime(10855): FATAL EXCEPTION: main
08-02 11:46:08.191: E/AndroidRuntime(10855): java.lang.RuntimeException: Unable to get provider com.atami.ics.provider.NodeIndexProvider: java.lang.NullPointerException
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread.installProvider(ActivityThread.java:4563)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4190)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4132)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread.access$1300(ActivityThread.java:130)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.os.Handler.dispatchMessage(Handler.java:99)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.os.Looper.loop(Looper.java:137)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread.main(ActivityThread.java:4745)
08-02 11:46:08.191: E/AndroidRuntime(10855): at java.lang.reflect.Method.invokeNative(Native Method)
08-02 11:46:08.191: E/AndroidRuntime(10855): at java.lang.reflect.Method.invoke(Method.java:511)
08-02 11:46:08.191: E/AndroidRuntime(10855): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
08-02 11:46:08.191: E/AndroidRuntime(10855): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
08-02 11:46:08.191: E/AndroidRuntime(10855): at dalvik.system.NativeStart.main(Native Method)
08-02 11:46:08.191: E/AndroidRuntime(10855): Caused by: java.lang.NullPointerException
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.model.ColumnModel.fk_declaration(ColumnModel.java:99)
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.model.ColumnModel.toSQL(ColumnModel.java:33)
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.model.TableModel.toSQL(TableModel.java:23)
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.ClassContentProvider.getCreationString(ClassContentProvider.java:103)
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.ClassContentProvider.access$0(ClassContentProvider.java:100)
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.ClassContentProvider$DBHelper.onCreate(ClassContentProvider.java:206)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164)
08-02 11:46:08.191: E/AndroidRuntime(10855): at it.mmo.classcontentprovider.ClassContentProvider.onCreate(ClassContentProvider.java:122)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.content.ContentProvider.attachInfo(ContentProvider.java:1058)
08-02 11:46:08.191: E/AndroidRuntime(10855): at android.app.ActivityThread.installProvider(ActivityThread.java:4560)
08-02 11:46:08.191: E/AndroidRuntime(10855): ... 12 more

Content Provider:

https://gist.github.com/3238104

NodeIndex.java

https://gist.github.com/3238111

JAR download is out of date

When I added the ccp.jar to my build path, the @column annotation could not be found. When I exported the source packages to a jar, however, the annotation was able to be imported.

Fantastic library my friend.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.