at 3:54, where you use val bundle: Bundle? = intent.extras val msg = bundle!!.getString("user_message") If I understand correctly, you get all the extras (information passed) from MainActivity, why would you use that instead of something like this: val msg: String = intent.getStringExtra("user_message")? I think that way it's a little less confusing for beginners.
I didn't get text(from getText()/setText()) CharSequence!. I only got an option with "Editable!" instead of "CharSequence!". That not worked. When I used txvUserMessage.setText(msg) it worked.
My app doesn't open on android device. And it shows a warning msg " The 'kotlin-android-extensions' Gradle plugin is deprecated ", please help me with it.
txvUserMessage.text = msg Here msg get red underlined and says "Type Mismatch, required Editable!, Found: String?" but when I use this txvUserMessage.setText(msg) then app get crashed when I enter any text and click the button. it says "RuntimeException: Unable to start activity" "textview.MaterialTextView cannot be cast to android.widget.EditText at android.app" So What should I do. I have checked your code on github, what would be the solution .?
My app is keep crashing when i try to navigate to the next activity. And when i saw in the logcat it say "Kotlin.KotlinNullPointerException" I even compared the code and its same Plz help
This might have caused because you declared putExtra() after startActivitiy() in the Intents . Also , usage of !! operator throws NullPointerException. If you want to avoid NPE , you can use '?' operator instead !
I think a Bundle is just all the information that you passed from the sending Activity. In this case it was only one String message, but you might have send a lot more information, and that's the bundle. Extra, as in putExtra(key, value) means that you're putting something "extra" in the bundle. What he means by key/value pair is like a dictionary: if you look up a word (key) you'll find the definition (value). A not null assertion operator removes the headaches of something called a NullPointerException. It automatically deals with trying to access information that is not there, instead of crashing your program completely. Basically it's saying: "Hey, if there is a Bundle here, pass me all the Extra information"
Sir why these types of videos are that much underrated........
Greetings from Jamaica. Excellent Video as usual.
Thanks alot. Make sure you visit www.smartherd.com/ . A lot of content will be there soon
Greetings from Bangladesh. Excellent Video as usual.
at 3:54, where you use
val bundle: Bundle? = intent.extras
val msg = bundle!!.getString("user_message")
If I understand correctly, you get all the extras (information passed) from MainActivity, why would you use that instead of something like this:
val msg: String = intent.getStringExtra("user_message")?
I think that way it's a little less confusing for beginners.
I avoid shortcuts in videos, as these videos targets beginners
Can you please make a video on passing data from Activity to Fragment and Fragment to Fragment in Kotlin? I will pay you seriously.
I didn't get text(from getText()/setText()) CharSequence!. I only got an option with "Editable!" instead of "CharSequence!". That not worked. When I used txvUserMessage.setText(msg) it worked.
Hi, I got a problem where the second activity crashes, whenever I get the message value from the first activity
My app doesn't open on android device. And it shows a warning msg " The 'kotlin-android-extensions' Gradle plugin is deprecated ", please help me with it.
Thank you for nice tutorial video. Thumbs up!
Is it not necessary to create the reference for the textview or edittext etc in main method as we are doing while using java in android studio
txvUserMessage.text = msg
Here msg get red underlined and says
"Type Mismatch, required Editable!, Found: String?"
but when I use this txvUserMessage.setText(msg) then app get crashed
when I enter any text and click the button. it says
"RuntimeException: Unable to start activity"
"textview.MaterialTextView cannot be cast to android.widget.EditText at android.app"
So What should I do. I have checked your code on github, what would be the solution .?
Where can I learn how to share data between fragments and from activity to fragment in kotlin
Even after declaring second activity in Android manifest file.. the error is coming.. that I have not declared it.. help!
Kindly check source code. Link in description
@@smartherd thanks!!!!!
what is the use of .java inside the intent
Thanks man. Nice videos.
Excuse me, Sir. Why do we need to put ? after Bundle ( val bundle : Bundle? ), What is the meaning of Bundle!!. Please reply me
learn kotlin first
Thank you so much bhai.
what does Bundle means??
@WingsOfTruth short and sweet explanation
intent.PutExtra doesn't work intent.putExtra ("user_ message", message)
My app is keep crashing when i try to navigate to the next activity.
And when i saw in the logcat it say "Kotlin.KotlinNullPointerException"
I even compared the code and its same
Plz help
This might have caused because you declared putExtra() after startActivitiy() in the Intents .
Also , usage of !! operator throws NullPointerException. If you want to avoid NPE , you can use '?' operator instead !
@@kabir. helped a lot!
@@kabir. thnx buddy it helped
Why operator after bundle
Few Questions..
-What is Bundle?
-What is extra?
-What is not null assertion operator?
and also what does these methods return?
I think a Bundle is just all the information that you passed from the sending Activity. In this case it was only one String message, but you might have send a lot more information, and that's the bundle.
Extra, as in putExtra(key, value) means that you're putting something "extra" in the bundle. What he means by key/value pair is like a dictionary: if you look up a word (key) you'll find the definition (value).
A not null assertion operator removes the headaches of something called a NullPointerException. It automatically deals with trying to access information that is not there, instead of crashing your program completely. Basically it's saying:
"Hey, if there is a Bundle here, pass me all the Extra information"
Perfect (Y)