KotlinTutorial | Learn Kotlin programming from scratch | Android library
kandi X-RAY | KotlinTutorial Summary
kandi X-RAY | KotlinTutorial Summary
Learn Kotlin programming from scratch
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of KotlinTutorial
KotlinTutorial Key Features
KotlinTutorial Examples and Code Snippets
Community Discussions
Trending Discussions on KotlinTutorial
QUESTION
Just to clarify beforehand, I have searched extensively in SO for similar question to find an answer to my question.
I will reference the following (to name a few sources) :
- How to start a new activity from a non activity class in Android kotlin?
- Start a new Activity from non Activity class
- Basic Kotlin Tutorial
I have a MainActivity and four other different activities, let's call them A through D.
I also have a Utilities class which sets on click listeners to image buttons found in activities A through D.
These listeners then open a new activity, E.
For some reason, in the
onCreate
method for activity E,savedInstanceState
is always null. I have tried setting the listener from the MainActivity, but to no avail. I have also passed the context from the MainActivity (instead of using the scroll view's), but that had not effect either
Below is a snippet of the code.
Utilities.kt
...ANSWER
Answered 2020-Jan-31 at 06:12Instead of savedInstanceState
you need to use getIntent()
. So your code will change like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install KotlinTutorial
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page