Cannot be allowed or is not a field

I would like to ask how can I solve this problem.

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); textOut =(TextView) findViewById(R.id.tvGetInput); getInput = (EditText) findViewById(R.id.etInput); Button ok = (Button) findViewById (R.id.bOk); ok.setOnClickListener(new View.OnClickListener() { 

(tvGetInput, etInput, bOk has an error) he says: "cannot be resolved or is not a field"

+4
source share
2 answers

first clean your project reassembly as follows:

Project ==> Clear ==> Check the project and click OK.

second, check your import, if there is import android.R , delete it, you must import R of your project:

example: import com.test.R;

Hello

+5
source

Check your import. There should not be android.R . Also check to see if these identifiers have been declared in the main layout. If everything is in order, clean and create your project.

+1
source

All Articles