MOHAMED
MOHAMED

Reputation: 43518

object constructor using this into a runnable

I m trying to call an object constructor into a runnable but Eclipse return error. The

simpleAdapter = new SimpleStandardAdapter(this, manager, LEVEL_NUMBER, this, headendDataLookup, findViewById(R.id.moduleDetailView));

is not accepted into the runnable. the problem are related to this variables. the eclipse suggest theses variable with Runnable

public void updateTreeView()
    {
        this.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                if (treeView == null)
                    return;
                updateTreeContent();
                simpleAdapter = new SimpleStandardAdapter(this, manager, LEVEL_NUMBER, this, headendDataLookup, findViewById(R.id.moduleDetailView));
                setTreeAdapter(TreeType.SIMPLE);
                setCollapsible(true);
                registerForContextMenu(treeView);
                manager.collapseChildren(null);
            }
        });
    }

Upvotes: 0

Views: 127

Answers (2)

Ankitkumar Makwana
Ankitkumar Makwana

Reputation: 3485

this may helps you

  simpleAdapter = new SimpleStandardAdapter(ActivityName.this , manager, LEVEL_NUMBER, ActivityName.this , headendDataLookup, findViewById(R.id.moduleDetailView));

Upvotes: 0

nandeesh
nandeesh

Reputation: 24820

You will need a context object. So use

  ActivityName.this 

instead of this.

In your case this points to runnable

Upvotes: 2

Related Questions