I can’t think of any good reason to do anything in the constructor. You never construct an activity directly, so you can’t use it to pass in parameters. Generally, just do things in onCreate.
More Related Contents:
- Creating new Android (Java ) file in Existing Android package [closed]
- Start another activity with button
- Android – Get real path of a .txt file selected from the file explorer
- Maximum length of Intent putExtra method? (Force close)
- Sending arrays with Intent.putExtra
- How do you use Intent.FLAG_ACTIVITY_CLEAR_TOP to clear the Activity Stack?
- Prevent Android activity dialog from closing on outside touch
- How do you pass a string from one activity to another? [duplicate]
- How to set background color of an Activity to white programmatically?
- Garbage collector in Android
- How can I avoid garbage collection delays in Java games? (Best Practices) [closed]
- Android Studio cannot resolve symbol but code executes correctly
- Android Unable to instantiate activity: Didn’t find class on path
- android.app.Application cannot be cast to android.app.Activity
- Android Center text on canvas
- How to resume Android Activity programmatically from background
- Issue: Passing large data to second Activity
- SQLiteOpenHelper failing to call onCreate?
- Android Call a method from another class
- How to exit an Android app programmatically?
- The activity must be exported or contain an intent-filter
- Android “single top” launch mode and onNewIntent method
- resuming an activity from a notification
- What’s the difference between this and Activity.this
- Static references are cleared–does Android unload classes at runtime if unused?
- how to programatically theme an activity to be like a dialog?
- IllegalArgumentException: Unknown URL content:// CONTENT
- Android: Navigation-Drawer on all activities
- Passing ArrayList of string arrays from one activity to another in android
- Using the camera activity in Android