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.
More Related Contents:
- my app keeps stopping in android emulator [closed]
- Android call api route every few seconds
- Replace string \ with / android [duplicate]
- Passing data to another activity (Android Studio) [duplicate]
- Custom fonts and XML layouts (Android)
- When exactly is it leak safe to use (anonymous) inner classes?
- How to load a Java class dynamically on android/dalvik?
- BitmapFactory.decodeResource returns a mutable Bitmap in Android 2.2 and an immutable Bitmap in Android 1.6
- How can I get the current screen orientation?
- Is there a way to paginate queries by combining query cursors using FirestoreRecyclerAdapter?
- exposed beyond app through ClipData.Item.getUri
- How to get unique random product in node Firebase?
- Android Firestore convert array of document references to List
- java.net.UnknownHostException: Unable to resolve host “”: No address associated with hostname and End of input at character 0 of
- Android Web Scraping with a Headless Browser [closed]
- Android: Prompt user to save changes when Back button is pressed
- Android Studio: failed to complete gradle execution, cause is empty
- multiple dex files define landroid/support/annotation/AnimRes
- Android – Get value from HashMap
- Image Orientation – Android
- Firebase can’t save retrieved data to ArrayList
- Android app in Eclipse: Edit text not showing on Graphical layout
- Crossplatform iPhone / Android code sharing
- Android Failed to instantiate one or more classes
- Android: detect brightness (amount of light) in phone’s surroundings using the camera?
- How to pass data from Recyclerview to Fragment
- Android: java.lang.NullPointerException: Attempt to invoke virtual method ‘java.lang.String java.lang.Object.toString()’ on a null object reference
- Error inflating class android.support.design.widget.TabLayout
- Default Navigation Drawer View to ExpandableListView
- Class must either be declared abstract or implement abstract method error