Very frustrating problem I have here. I have this code:
Button b = findViewById(android.R.id.button1);
And I\'m getting this error on it:
remove android.R from packages
and import your R
.
import com.companyname.productname.R;
and change also button refrence
Button b = (Button)findViewById(R.id.button1);
^^^^^^^^^^^^
You need to cast the view to Button:
Button b = (Button) findViewById(android.R.id.button1);
More details at http://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html
In addition, as answered by others, the id is wrong.
Your mistake is here-Button b = findViewById(android.R.id.button1);
Replace the above line by findViewById(R.id.button1);