HOW TO START A NEW ACTIVITY IN KOTLIN | HOW TO OPEN A NEW ACTIVITY WITH BUTTON ANDROID STUDIO KOTLIN

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys welcome to my channel today in this video tutorial we are going to learn about adding a new activity into our project as well as uh how can we navigate to an infectivity with a button click so let's start so i have created this project in which i have this activityman.xml file and this main activity.kt file this is the designer file so we have nothing on the designer and this is the main activity.kt file and we have nothing here too so i will go to this main activity.xml file and drag in a button on this now i'll uh go to its code and i'll make this a match parent [Applause] and i'll give this a text [Applause] go to second activity and now i'll again go to design and now i'll pin it from the top i will move this to the top and i'll pin it from this side as well as this side i will give it some margins 24 from this side and 24 from this side and now we will add in an activity a new activity into our project so we will click on this or on this java file and new and will come to this uh activity and from here i'll use uh empty activity click here and uh i'll name this second activity and now i'll click finish so it will create a second activity for us now you can see that the second activity is created so i'll go to this uh main activity and first i will go to this xml and i'll check for its id for this button idr i will change this btn and now the id is changed so i'll go to now this main activity and here i'll connect that button that xml button here wall nav btn equals find view by id or button and here i will use or dot id dot btn and now i'll create its click even so nav button dots it on let listener and on click listener and now here i will navigate to second activity but first i will go to second activity and here i will add in a text view and i'll pin it to the top to bottom bottom as well as to this side and to this side and now i'll go to code and here i change this this is second activity and i'll change the text size to 25 sp and text color to hash cc f f 0 0 and now i'll go to this main activity.kt file and here inside this button click i'll use wall intent equals intent and now i'll use the context here so i'll use this and then it takes the second activity so i'll use a second activity then full column full colon and then class dot java and now i'll start uh activity and i'll pass in the intent here now if i run this application right now so now the application is running on the emulator so if i go to this blue stack and click on this go to second activity now you can see that we can go to this is second activity so we are in second activity now if i go back and go back to first activity so that's all for today i hope you like the video if you like the video please like subscribe and comment thank you
Info
Channel: Programming Guru
Views: 53
Rating: undefined out of 5
Keywords: Programming Guru, Guru Programming, programming, gurru, programminggurru, how to navigate between activities in android kotlin, how to start a new activity in android kotlin, navigate between activities in android kotlin, passing from one activity to another in Android, Navigate between screen in android kotlin, kotlin android for beginners, how to open a new activity with button in android studio kotlin, open a new activity with button click, starting a new activity in kotlin
Id: 8nfZH34yhYE
Channel Id: undefined
Length: 5min 49sec (349 seconds)
Published: Fri Dec 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.