Calling close() on a Cursor that's backing a ListView

by westmeadboy » Sat, 10 Apr 2010 00:55:29 GMT


Sponsored Links
 I'm using a SimpleCursorAdapter with ListView.

I just noticed that calling AbstractCursor.close() in a non-UI thread
will cause this exception:

android.view.ViewRoot$CalledFromWrongThreadException: Only the
original thread that created a view hierarchy can touch its views.
    at android.view.ViewRoot.checkThread(ViewRoot.java:2462)
    at android.view.ViewRoot.requestLayout(ViewRoot.java:512)
    at android.view.View.requestLayout(View.java:7071)
    at android.view.View.requestLayout(View.java:7071)
    at android.view.View.requestLayout(View.java:7071)
    at android.view.View.requestLayout(View.java:7071)
    at android.view.View.requestLayout(View.java:7071)
    at android.widget.AbsListView.requestLayout(AbsListView.java:969)
    at android.widget.AdapterView
$AdapterDataSetObserver.onInvalidated(AdapterView.java:811)
    at
android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java:
43)
    at
android.widget.BaseAdapter.notifyDataSetInvalidated(BaseAdapter.java:
54)
    at android.widget.CursorAdapter
$MyDataSetObserver.onInvalidated(CursorAdapter.java:391)
    at
android.database.DataSetObservable.notifyInvalidated(DataSetObservable.java:
43)
    at
android.database.AbstractCursor.deactivateInternal(AbstractCursor.java:
89)
    at android.database.AbstractCursor.close(AbstractCursor.java:108)

Is this a bug or intentional?

--



Other Threads

1. last modified time Contact

Hi guys,
how can i get the last modified time of a Contact ( Android 2.1)?

-- 

2. can i use HTTP/1.0 in my HttpClient?

Hi Dear,

by default HttpClient use HTTP/1.1 protocol, is there any way to
change it to HTTP/1.0?
any idea?

-- 

3. OOT: Thanks to para Suhu dan Suhi

4. Fouder Id-android

5. Strange behavior when launching app from Market

6. about google map nearby search

7. WebView pre-executing JavaScript before loading a page