Following the notepad example in the SDK i have created my
ContentProvider class, my BaseColumns class and added the provider to
the manifest file.
Manifest:
<provider android:name="com.smithmyers.providers.MGProvider"
android:authorities="com.smithmyers.providers.MGScans"
/>
Provider and BaseColumns classes are almost identical to the NotePad
example though using my content URI and a slightly different table in
my database.
in onCreate in my activity i have the following code:
Intent intent = getIntent();
if (intent.getData() == null) {
intent.setData(Scans.CONTENT_URI);
}
getContentResolver().insert(intent.getData(), null);
>From this code i get this error:
Uncaught handler: thread main exiting due to uncaught exception
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.smithmyers.smmobileapps/c
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2496)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2512)
at android.app.ActivityThread.access$2200(ActivityThread.java:
119)
at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1863)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4363)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at
android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:
98)
at com.smithmyers.providers.MGProvider.insert(MGProvider.java:
107)
at android.content.ContentProvider
$Transport.insert(ContentProvider.java:150)
at android.content.ContentResolver.insert(ContentResolver.java:
629)
at
com.smithmyers.smmobileapps.mobilegoose.MobileGoose.onCreate(MobileGoose.java:
56)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2459)
Any suggestions?
Ne0
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en