I am extremely extremely new to Java and programming in general. I wrote this for a basic program to add 2 numbers input by the user and add them up and display them in the output box, however I'm getting Non-static method 'setText(java.lang.CharSequence)' cannot be referenced from a static context
, but I don't know what the static thing is
private void onClick(View v) {
EditText input1 = (EditText) findViewById(R.id.input1);
double calc1 = Double.parseDouble(String.valueOf(input1));
EditText input2 = (EditText) findViewById(R.id.input2);
double calc2 = Double.parseDouble(String.valueOf(input2));
double total = calc1 + calc2;
String result = Double.toString(total);
EditText output1 = (EditText) findViewById(R.id.output);
EditText.setText(result);
}
The line giving the error:
EditText.setText(result);
Sorry if I'm being extremely incompetent but I searched and I couldn't really understand how to fix it. Thanks.