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(
    at android.view.ViewRoot.requestLayout(
    at android.view.View.requestLayout(
    at android.view.View.requestLayout(
    at android.view.View.requestLayout(
    at android.view.View.requestLayout(
    at android.view.View.requestLayout(
    at android.widget.AbsListView.requestLayout(
    at android.widget.AdapterView
    at android.widget.CursorAdapter
    at android.database.AbstractCursor.close(

Is this a bug or intentional?


Other Threads

1. google gdata Calender api problems with android

1. As written in
monthOfYear     The month that was set (0-11) for compatibility with

2. Did you try to print startdate and enddate to be sure of their
values ? Your code is not complete, where did you declare mYear,
mMonth and mDay ?

3. I'm not sure but I suppose that getEntries gives the result from
the last application on top, like getExtras.

I have one question for you : what packages are you using ? I googled
for days looking how to get datas from gmail without success.



2. Why on Earth is it so hard to set up the development environment?

I've used PHP/Apache/mySQL/HTML/CSS/JavaScript for years. I've also do
a bit of ASP and vBasic coding. In order to use these tools I've had
to install various development environments in my time.

But this Android Dev kit has me stumped.

The installation instructions are not clear at all. Do I need to DL
Eclipse first? Which order do things need installing? Its totally
baffling and I understand why even my Android dev friends say that the
iPhone OS dev kit is much easier to use.

I've DLed and installed the Java JDK 6, Eclipse and the Android SDK.
Eclipse wont start as it says it needs Java JRE, the Android SDK setup
wont find the updates and says to enforce HTTP in the settings but in
settings there IS no HTTP force, only HTTPS force - which is what is

Why on Earth can we not have one nice neat package that just installs
it all for us? I already have to learn Java ffs, why should I have to
wrestle with installing this?

Is there any guide that is not on that
isn't so incomprehensible?


3. ListViews, Tabs & Back buttons!!

4. How to get more than one result from Voice Recognition?

5. Error in Activity Lifecycle diagram? When to open/close SQLite db?

6. "Hello Views" tutorial contains an error in the source

7. Kansas City - Android Development project - LOCAL ONLY