设置列表视图数据时出错

时间:2013-12-31 10:00:51

标签: android android-listview cursor

当我尝试调用runQuery(CharSequence constraint)方法时,出现以下错误,我的应用程序崩溃。

在该方法中,我传递的是MatrixCursor,它是从服务器重新获取的数据创建的。

12-31 15:20:45.269: D/Dialapp(3896): ActivitySIPCallScreen:parseIntent
12-31 15:20:48.479: E/RESPONSE:(3896): IP:192.168.1.121 URL: http://192.168.1.121/FMC_api/
12-31 15:20:51.519: D/dalvikvm(3896): GC_CONCURRENT freed 1406K, 14% free 12741K/14723K, paused 3ms+3ms
12-31 15:21:00.199: E/ActivityThread(3896): Activity com.godialect.dialapp.ui.ActivitySIPCallScreen has leaked ServiceConnection com.godialect.dialapp.ui.ActivitySIPCallScreen$1@4140ffd8 that was originally bound here
12-31 15:21:00.199: E/ActivityThread(3896): android.app.ServiceConnectionLeaked: Activity com.godialect.dialapp.ui.ActivitySIPCallScreen has leaked ServiceConnection com.godialect.dialapp.ui.ActivitySIPCallScreen$1@4140ffd8 that was originally bound here
12-31 15:21:00.199: E/ActivityThread(3896):     at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:936)
12-31 15:21:00.199: E/ActivityThread(3896):     at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:830)
12-31 15:21:00.199: E/ActivityThread(3896):     at android.app.ContextImpl.bindService(ContextImpl.java:1129)
12-31 15:21:00.199: E/ActivityThread(3896):     at android.content.ContextWrapper.bindService(ContextWrapper.java:370)
12-31 15:21:00.199: E/ActivityThread(3896):     at com.godialect.dialapp.ui.ActivitySIPCallScreen$2.run(ActivitySIPCallScreen.java:331)

代码段:

public Cursor runQuery(CharSequence constraint) {

    stopManagingCursor(mContactsCursor);        

        contacts.moveToFirst();     
        //ProgressDialog dialog = ProgressDialog.show(ActivityDialerScreen.this, "Loading,", " ==" +  contacts.getString(0), true);
        return contacts;
}

    mAsyncContactImageLoader = new AsyncContactImageLoader( getApplicationContext(), getResources().getDrawable(R.drawable.contactlist_default_image));
    mCallLogAdapter = new Adapter_CallLogs(getApplicationContext(), null, mAsyncContactImageLoader);
    mContactsAdapter = new Adapter_Contacts(getApplicationContext(), mContactsCursor, mAsyncContactImageLoader);
    mContactsAdapter.setFilterQueryProvider(this);
    mContainerDialerScreen.contactList.setAdapter(mContactsAdapter);

Adapter_Contacts is at here

GroupingCursorAdapter is at here

1 个答案:

答案 0 :(得分:1)

此错误表示ActivitySIPCallScreen已完成,之后您一直在尝试从其上下文中启动ServiceConnection

另请阅读此answer有关泄漏活动的信息。