什么"无效声明fillWindow()"在Android的游标是什么意思? [英] What does "invalid statement in fillWindow()" in Android cursor mean?

查看:141
本文介绍了什么"无效声明fillWindow()"在Android的游标是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有时会看到我的的logcat 输出这个错误,

I sometimes see this error in my logcat output,

Cursor: invalid statement in fillWindow().

这有时会发生在我preSS返回键,然后转到默认的Andr​​oid 列表视图才去我的自定义列表视图

It sometimes happens when I press the back key and then it goes to the default Android listview before going to my custom listview.

这是什么意思?如何解决这个问题呢?因为它不指向code那里的问题是来自任何线路。

What does it mean? How do I solve it? Because it does not point to any line of code where the problem is coming from.

推荐答案

在与ListActivities处理,这个问题已经做的游标对象,CursorAdapter的对象和数据库对象没有被正确关闭时,活动停止,而不是被正确设置在活动开始或恢复。

When dealing with ListActivities, this issue has to do with the Cursor objects, CursorAdapter objects, and Database objects not being closed properly when the Activity stops, and not being set properly when the Activity starts or resumes.

我必须确保我闭上了SimpleListAdapter,我的光标,然后在各自的顺序我的数据库对象,在活动的onStop方法TabActivity恢复时调用。

I had to make sure that I closed my SimpleListAdapter, my Cursors, and then my Database objects in that respective order, in the onStop method of the Activity that is called when the TabActivity resumes.

我已经关闭游标和数据库对象,但尚未关闭我的SimpleListAdapter光标。

I had already been closing the Cursor and Database objects, but had not been closing my SimpleListAdapter Cursor.

/**
   * onStop method
   * 
   * Perform actions when the Activity is hidden from view
   * 
   * @return void
   * 
   */
  @Override
  protected void onStop() {
    try {
      super.onStop();

      if (this.mySimpleListAdapterObj !=null){
        this.mySimpleListAdapterObj.getCursor().close();
        this.mySimpleListAdapterObj= null;
      }

      if (this.mActivityListCursorObj != null) {
        this.mActivityListCursorObj.close();
      }

      if (this.myDatabaseClassObj != null) {
        this.myDatabaseClassObj.close();
      }
    } catch (Exception error) {
      /** Error Handler Code **/
    }// end try/catch (Exception error)
  }// end onStop

这篇关于什么"无效声明fillWindow()"在Android的游标是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆