什么"无效声明fillWindow()"在Android的游标是什么意思?游标、声明、QUOT、Android

由网友(贱是惯出来の病)分享简介:我有时会看到我的的logcat 输出这个错误,I sometimes see this error in my logcat output, Cursor: invalid statement in fillWindow().这有时会发生在我preSS返回键,然后转到默认的Andr​​oid 列表视图才去我的自定义...

我有时会看到我的的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
阅读全文

相关推荐

最新文章