Skip to content Skip to sidebar Skip to footer

How Do I Return A Runnable In This Method?

I don't know how to make a Return on a Runnable Method (or w/this particular method). I may have the idea wrong to(?). Any help? thnx! *This is continued/related from this post. Bu

Solution 1:

There's no reason to use a method to return a Runnable. Simply declare a member (or static final) Runnable. All the code that executes goes in the run() method.

private static final Runnable ORDER_ASC = new Runnable() {
    public void run() {
        Cursor databaseCursor = db.rawQuery(
            "SELECT * FROM AC_list ORDER BY `label` ASC", null);

        Adapter_AC databaseListAdapter = new Adapter_AC(this,
            R.layout.list_item, databaseCursor, new String[] { "label",
                    "title", "description", "gotoURL" }, new int[] {
                    R.id.label, R.id.listTitle, R.id.caption, R.id.dummy });

        databaseListAdapter.notifyDataSetChanged();
        this.setListAdapter(databaseListAdapter);
    }
};

Post a Comment for "How Do I Return A Runnable In This Method?"