Kotlin Android Tutorial: Share Data between Activities using Explicit Intent #2.4

Поделиться
HTML-код
  • Опубликовано: 2 дек 2024

Комментарии • 34

  • @virtualcurve6341
    @virtualcurve6341 5 лет назад +6

    Sir why these types of videos are that much underrated........

  • @jahbless4ever
    @jahbless4ever 6 лет назад +3

    Greetings from Jamaica. Excellent Video as usual.

    • @smartherd
      @smartherd  6 лет назад +1

      Thanks alot. Make sure you visit www.smartherd.com/ . A lot of content will be there soon

  • @md.shorifulhasan3149
    @md.shorifulhasan3149 4 года назад

    Greetings from Bangladesh. Excellent Video as usual.

  • @89Valkyrie
    @89Valkyrie 6 лет назад

    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.

    • @smartherd
      @smartherd  6 лет назад

      I avoid shortcuts in videos, as these videos targets beginners

  • @cosovic14
    @cosovic14 4 года назад +3

    Can you please make a video on passing data from Activity to Fragment and Fragment to Fragment in Kotlin? I will pay you seriously.

  • @joysonjohn4467
    @joysonjohn4467 4 года назад +1

    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.

  • @VirtuosicBeats
    @VirtuosicBeats 2 года назад

    Hi, I got a problem where the second activity crashes, whenever I get the message value from the first activity

  • @ruchikagoyal1909
    @ruchikagoyal1909 2 года назад

    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.

  • @xjstree
    @xjstree 4 года назад

    Thank you for nice tutorial video. Thumbs up!

  • @prashantsawarwadkar5127
    @prashantsawarwadkar5127 6 лет назад

    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

  • @arjunshinde7
    @arjunshinde7 4 года назад

    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 .?

  • @cosovic14
    @cosovic14 4 года назад

    Where can I learn how to share data between fragments and from activity to fragment in kotlin

  • @theblackvirtus
    @theblackvirtus 6 лет назад +1

    Even after declaring second activity in Android manifest file.. the error is coming.. that I have not declared it.. help!

    • @smartherd
      @smartherd  6 лет назад +1

      Kindly check source code. Link in description

    • @theblackvirtus
      @theblackvirtus 6 лет назад +1

      @@smartherd thanks!!!!!

  • @MahammadRafiShaik-iw3tf
    @MahammadRafiShaik-iw3tf 2 года назад

    what is the use of .java inside the intent

  • @thanasisathanasi4965
    @thanasisathanasi4965 5 лет назад

    Thanks man. Nice videos.

  • @jekigates8039
    @jekigates8039 4 года назад

    Excuse me, Sir. Why do we need to put ? after Bundle ( val bundle : Bundle? ), What is the meaning of Bundle!!. Please reply me

  • @aqibfayyaz1619
    @aqibfayyaz1619 4 года назад

    Thank you so much bhai.

  • @nileshtak9371
    @nileshtak9371 6 лет назад +2

    what does Bundle means??

    • @ALLINONETV1
      @ALLINONETV1 4 года назад +1

      @WingsOfTruth short and sweet explanation

  • @Raaz1026
    @Raaz1026 4 года назад

    intent.PutExtra doesn't work intent.putExtra ("user_ message", message)

  • @daniyalhabib3385
    @daniyalhabib3385 5 лет назад

    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

    • @kabir.
      @kabir. 4 года назад +5

      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 !

    • @aaronyx2124
      @aaronyx2124 4 года назад

      @@kabir. helped a lot!

    • @akshaychauhan4104
      @akshaychauhan4104 3 года назад

      @@kabir. thnx buddy it helped

  • @sahusapana
    @sahusapana 5 лет назад

    Why operator after bundle

  • @ai378
    @ai378 6 лет назад +1

    Few Questions..
    -What is Bundle?
    -What is extra?
    -What is not null assertion operator?
    and also what does these methods return?

    • @89Valkyrie
      @89Valkyrie 6 лет назад +3

      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"

  • @scubeuser9667
    @scubeuser9667 4 года назад

    Perfect (Y)