#4. How to move to New Activity on Button click | Intents | Android Development Tutorial 2021

#4. How to move to New Activity on Button click | Intents | Android Development Tutorial 2021

Anuj Bhaiya

3 года назад

101,353 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Binondi Borthakur
Binondi Borthakur - 28.09.2023 07:10

Sir ab android studio me default text size 14 sp hota hai

Ответить
Binondi Borthakur
Binondi Borthakur - 28.09.2023 07:06

Basically kotlin is a enhanced and optimised language of java🤔

Ответить
Pradeep kr
Pradeep kr - 19.08.2023 18:14

Help
I got error
Val name =nameInput.editableText.toString()
Show unresolved reference nameInput

Ответить
Scientific Human
Scientific Human - 30.06.2023 17:54

Finally made my first app! 🥳 Thank you so much bhaiya 🙏🏻

Ответить
Logic Overflow
Logic Overflow - 12.06.2023 19:48

In Java, there is no direct equivalent to Kotlin's companion object. However, you can achieve similar functionality by using a static inner class.

Ответить
Android MuKtar
Android MuKtar - 05.05.2023 17:34

You should shame on your self you purposely wasteing our time

Ответить
Nirvighna Saxena
Nirvighna Saxena - 05.05.2023 09:44

Text is not coming in cursive , how to resolve it ?

Ответить
Android MuKtar
Android MuKtar - 03.05.2023 18:34

You create problems in your videos to solve later on your comments 🤣

Ответить
Aditi Kumari
Aditi Kumari - 07.04.2023 11:30

I am getting error in mainActivity in this line
intent.putExtra(BirthdayGreetingActivity.NAME_EXTRA, name)
can anyone help me, please

Ответить
Akhil Panwar
Akhil Panwar - 01.04.2023 15:19

try this ! in case commented line causes error
//birthdayGreetings.text="Happy Birthday $name"
val textView = findViewById<TextView>(R.id.birthdayGreetings)
textView.setText("Happy Birthday $name").toString()

Ответить
Saheel Sutar
Saheel Sutar - 11.03.2023 17:35

Thanks bhaiya

Ответить
Soham Gaikwad
Soham Gaikwad - 08.03.2023 10:07

Sir i have set the image for first activity..and now i want to also set image to the second activity but i am not able to do it..please can you just tell me how?

Ответить
The Straw Hat Coder
The Straw Hat Coder - 25.02.2023 08:01

my app is not running it closes everytime i click on create card

Ответить
पापी गुडिया
पापी गुडिया - 16.01.2023 22:52

Phli baat to y ki intent vali line m error show kr rha

Ответить
coding shorts
coding shorts - 24.12.2022 15:54

bhaiya ek doubt aap chair pr baith kr record kr rhe ho ya khade hokar video record kr rhe

coding m koi doubt nii wo sb toh sahi chal gya

Ответить
Prakash Raj
Prakash Raj - 23.12.2022 18:30

birthday Greeting.text = "Happy Birthday $name"

i'm getting error

Ответить
Bibek Manandhar
Bibek Manandhar - 17.11.2022 20:21

if anyone is stuck on something, heres the working code :)
BirthdayGreeting Activity

package com.example.birthdaygreet


import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView



class BirthdayGreetingActivity : AppCompatActivity() {

companion object{
const val NAME_EXTRA = "name_extra"
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_birthday_greeting)
//finding birthdayText
val birthdayText = findViewById<TextView>(R.id.birthdayText)

val name = this.intent.getStringExtra(NAME_EXTRA)
birthdayText.text = "happy birthday\n$name !"

}
}

MainActivity.kt


package com.example.birthdaygreet

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.EditText





class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)


}
fun createBirthdayCard(view:View){
//Finding the edit text
val nameInput = findViewById<EditText>(R.id.name_input)

val name = nameInput.editableText.toString()

val intent = Intent(this, BirthdayGreetingActivity::class.java)
intent.putExtra(BirthdayGreetingActivity.NAME_EXTRA, name)
startActivity(intent)
}
}

Ответить
SUYASH MISHRA
SUYASH MISHRA - 09.11.2022 12:09

anyone can explain what anuj bhaiya said about dp and sp

Ответить