how to add my button in reference in java?

findViewById MUST be called after you call setContentView.

what’s more, R.java is not user editable, it’s automatically generated by android compiler based on your resource files. you should define android:id="@+id/btnsub" in your layout xml.

Leave a Comment