android 数据库的相关bug

错误log:

 Cursor leak detected, query params: uri=content://com.android.contacts/phone_lookup/02034520900, projection=null, selection=data1 = ?, selectionArgs=[Ljava.lang.String;@4272a880, sortOrder=null
 FATAL EXCEPTION: main
 java.lang.IllegalStateException: Process 23545 exceeded cursor quota 100, will kill it
     at android.os.Parcel.readException(Parcel.java:1433)
     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188)
     at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
     at android.content.ContentProviderProxy.query(ContentProviderNative.java:366)
     at android.content.ContentResolver.query(ContentResolver.java:411)
     at android.content.ContentResolver.query(ContentResolver.java:354)
     at com.yaloe8188.Common.getContactNameByPhoneNumber(Common.java:592)
     at com.yaloe8188.LatestActivity.setListItemAdapter(LatestActivity.java:473)
     at com.yaloe8188.LatestActivity.onCreate(LatestActivity.java:331)
     at android.app.Activity.performCreate(Activity.java:5084)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2044)
     at android.app.ActivityThread.startActivityNow(ActivityThread.java:1921)
     at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:135)
     at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:347)
     at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:694)
     at android.widget.TabHost.setCurrentTab(TabHost.java:358)
     at android.widget.TabHost.setCurrentTabByTag(TabHost.java:283)
     at com.yaloe8188.YaloeActivity.initView(YaloeActivity.java:374)
     at com.yaloe8188.YaloeActivity.onCreate(YaloeActivity.java:169)
     at android.app.Activity.performCreate(Activity.java:5084)
     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2044)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2105)
     at android.app.ActivityThread.access$600(ActivityThread.java:136)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
     at android.os.Handler.dispatchMessage(Handler.java:99)
     at android.os.Looper.loop(Looper.java:137)
     at android.app.ActivityThread.main(ActivityThread.java:4881)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:511)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:804)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:571)
     at dalvik.system.NativeStart.main(Native Method)

源代码:

 pCur.close();

解决办法:

if(null!=pCur){
                pCur.close();
            }

你可能感兴趣的:(android 数据库的相关bug)