onCreate()
ContentProvider
中的方法未被調用。雖然當我點擊一個按鈕時,它會進入insert()
方法並返回java.lang.NullPointerException
。在onCreate()
方法我已經只有在ContentProvider中的onCreate()未被調用
@Override
public boolean onCreate() {
Log.v(TAG,"Inside create provider");
database = new DatabaseSQLiteMyDB(getContext());
return false;
}
登錄CAT表示:
04-20 01:23:00.543: V/CLICKED(1607): CLICKED
04-20 01:23:00.553: V/Provider(1607): inside insert
04-20 01:23:00.573: V/database(1607): created
04-20 01:23:00.573: E/pkg.OnPut_ClickListener(1607): java.lang.NullPointerException
04-20 01:23:00.583: V/pkg.OnPut_ClickListener(1607): In exception code
在清單:
{
myURI=buildUri("content", "somepkg.provider");
this.putNo=putNo;
mContentValues = initTestValues();
}
private Uri buildUri(String scheme, String authority) {
Uri.Builder uriBuilder = new Uri.Builder();
uriBuilder.authority(authority);
uriBuilder.scheme(scheme);
return uriBuilder.build();
}
請發出更多的代碼並通過logcat完整棧跟蹤 – Daniel 2013-04-20 05:21:33
@sattu請發佈完整的StackList和更多代碼 – 2013-04-20 05:29:30