Android: Non-static method cannot be referenced from static context. Confused? [duplicate]

In a static context, you don’t have an object (instance of the class), but the instance variables and methods depend on them.

You have an instance, called output1, but you try to call your method ‘setText’ through the class’s name (which is a static approach).

Change your lines

EditText output1 = (EditText)findViewById(R.id.output);
    EditText.setText(result);

to

EditText output1 = (EditText)findViewById(R.id.output);
    output1.setText(result);

Leave a Comment