I am trying to produce a simple threaded note manager application for android 2.2. However , in my opinion, where I list all of the notes added in to the database, the thread that's handling the simpleCursorAdapter appears to crash each time.

I understand simpleCursorAdapters possess some performance issues, but I have to utilize it, because I can not use loaders. So this is exactly why I attempted running that in the own thread.

Here's the code I personally use to see the database after which place the outcomes in ListView:

package my.mobile.dev;

import helpers.DBAdapter;

import android.app.Activity;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;

public class GVActivity extends Activity implements OnClickListener {

    private Button backToMainButton;

    private int viewId;

    private DBAdapter db = new DBAdapter(this);
    private Cursor allTasksCursor;

    protected ListAdapter adapter;
    protected ListView tasksList;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.groupedview);
        tasksList = (ListView) findViewById(R.id.list);

        db.open();
        allTasksCursor = db.getAllTasks();
        db.close();

        new Thread(new Runnable() {
            public void run() {
                adapter = new SimpleCursorAdapter(
                        GVActivity.this, 
                        R.layout.tasks_list_layout, 
                        allTasksCursor, 
                        new String[] {"Name", "StartingDate","StartingTime","EndingDate","EndingTime"},
                        new int[] {R.id.taskName, R.id.startDate, R.id.startTime, R.id.endDate, R.id.endTime});
                tasksList.setAdapter(adapter);
            }
          }).start();




        backToMainButton = (Button) findViewById(R.id.backToMainButton);

        backToMainButton.setOnClickListener(this);


    }

    @Override
    public void onClick(View view) {
        viewId = view.getId();
        if(viewId == R.id.backToMainButton) {
            finish();
        }

    }

}

The final line within the debugger is

Thread [<9> Thread-10] (Suspended (exception RuntimeException)) 
Handler.<init>() line: 121  
CursorAdapter$ChangeObserver.<init>(CursorAdapter) line: 367    
SimpleCursorAdapter(CursorAdapter).init(Context, Cursor, boolean) line: 112 
SimpleCursorAdapter(CursorAdapter).<init>(Context, Cursor) line: 90 
SimpleCursorAdapter(ResourceCursorAdapter).<init>(Context, int, Cursor) line: 47    
SimpleCursorAdapter.<init>(Context, int, Cursor, String[], int[]) line: 84  
GVActivity$1.run() line: 60 
Thread.run() line: 1096 

And within the Handler is

this    Handler  (id=829732367912)  
    mCallback   null    
    mLooper null    
    mMessenger  null    
    mQueue  null    

I truly don't get sound advice here now. I'm not sure when the whole thread dies, but a minimum of the relaxation from the application stays responsive. I'm able to still utilize it, but I'll never begin to see the data I've placed in to the database. What is the issue?

-Z