Scribe
Scribe

ชอบมันไหม? ทำให้ Scribe ดียิ่งขึ้นโดย การให้คะแนน

รับส่วนขยาย Chrome

เรียกดู

  • วิดีโอยอดนิยม
  • วิดีโอล่าสุด
  • ช่องทั้งหมด

เครื่องมือฟรี

  • ตัวดาวน์โหลดคำบรรยาย
  • ตัวสร้างเวลา
  • ตัวสรุปวิดีโอ
  • ตัวนับคำ
  • ตัววิเคราะห์ชื่อเรื่อง
  • ค้นหาบทถอดความวิดีโอ
  • การวิเคราะห์วิดีโอ
  • ตัวสร้างบท
  • ตัวสร้างแบบทดสอบ
  • แชทกับวิดีโอ

ผลิตภัณฑ์

  • ราคา
  • บล็อก

Developers

  • Transcript API
  • API Documentation

กฎหมาย

  • ข้อกำหนด
  • ความเป็นส่วนตัว
  • การสนับสนุน
  • แผนผังเว็บไซต์

ลิขสิทธิ์ © 2026 สร้างด้วยความรักโดย Scribe

— ถ้านี่ทำให้ชีวิตของคุณง่ายขึ้น (หรืออย่างน้อยก็วุ่นวายน้อยลง) กรุณาให้คะแนนเรา! เราสัญญาว่ามันจะทำให้วันของเราดีขึ้น 😊

Related Videos

Simple Kotlin App | Android Studio | 2024

Video thumbnail
112.74k1,693 คำ8m readGrade 18
แชร์
Channel
Easy Tuto
what is going on guys welcome back to another Android application development video in Android Studio in this video we are going to learn how to create our first application with the kotlin till now we were developing our application using Java but now we will start developing our application with kotlin which is the official language for the Android it is not very different from java we are familiar with the Java now we will get familiar with the kotlin so let's start our new project so here I have updated Android Studio so my Android Studio is now latest that is giraffe version so let's click on new project so previously we used to select empty activity from now on we will select empty views activity because this empty activity is for Jetpack composable so we are not using that we are using views so we will click on empty views Activity Click on next so here you can give the application name so application name will be my kotlin app package name you can give anything and most importantly language is pre-selected that is kotlin so we are selecting Java in previous videos now we will select kotlin it is already selected minimum SDK you can choose anyone let's choose nougat and build configuration Let It Be recommended one so click on finish so as you can see our project is loaded and we have this mainactivity. kt previously we used to have main activity. java now it is KT extension that means we are using cotin so activity main.
xml will be as it is click on split this is as it is and this will be main activity. kt here also we have oncreate function all the things are same just the syntax are different so let's run this application and see so as you can see our application is launched and we have this hello world over here now let's add some views so go to activity main. xml and we will Design so for this I will remove this text View let's remove it you can use any layout but I will use for now linear layout and orientation let's say vertical let's quickly design a simple app where we will take the edit text width will be match parent height will be wrap content hint will be enter a I'll give the ID to it foreign let's give some margin as well about 20 DB let's copy this and create one more enter B and it will be enter B so we have to edit text over here let's give margin to this linear layout as well so we have to edit text now we will add some buttons and result text view so for buttons I will use another linear layout width will be match parent height will be wrap content orientation will be horizontal and I will add four buttons so buttons will be wrap content wrap content text addition ID will be button add let's give some margin about 4 DB let's copy this button and paste it four times so we have these four buttons second button will be subtraction third button will be multiply and fourth button will be division so here button division ID will be button multiplication here it will be subtraction in this way we will calculate two numbers and we will show a result over here so after this we'll show text View width will be match parent height will be wrap content text will be for now let's say result text size will be 24 SP and gravity will be Center so as you can see over here we can see the result let's give margin so in this way we designed our simple application let's go to mainactivity.
kt now so in mainactivity. kd previously in Java what we used to do we used to write here button button add and here what we used to do button add equals to find view by ID r dot ID dot ID so here in kotlin what we will do we have to first Define here with late in it where button add type will be button in this way we have defined it and here we can do same thing find view by d r dot ID dot button add so in this way we can do so let's copy this and paste it four times it will be button subtract button multiplication button division so in this way we can give ID for all those so it is the same thing what we were doing in Java let's initialize edit text also e t a edit text and ET B edit text and one text view result TV which will be text View now we have to implement on click listener to all of them so what we will do is inherit from on click listener so here what we will do we have already narrated this so comma it will be view dot on click listener let's import it we can do directly from here also like button add dot on click listener set on click listener but there are four button that's why we are doing here so that we can get the ID and Implement directly so let's Implement members that will be on click here we can use the switch case but there is no switch case in kotlin so we will use when p 0 that means parameter here we can say V when the V Dot ID when V Dot ID and then we will check so here view is nullable so we have to write question mark so that it will be null safe when we have ID if the ID is r dot ID Dot add then we'll do something if ID is subtraction then we'll do something if ID is multiplication then we'll do something per division so here we can write the body what will happen so to do the calculation what we will do first I will create two local variables that will be variable a equals to I will take the value from ETA that will ETA dot get text we have get text in Java but here we can directly write text Dot two string so it will get the value in a string if you hover over here you can see this is a string but we have to convert it to double so that we can calculate so 2 Double so we have the value of this edit text in the a that will be double value duplicate it make it B ETA will be ETA B so we'll get both the values now what we will do so we will also create one variable that will be result of type double or you can directly initialize it like 0 1 0 it will automatically take that it is double so let's go to add body here what we will do result equals to A plus b that's it let's go to subtraction result equal to a minus B for multiplication result equals to A multiply B foreign by B so in this way we have calculated the result and put it in result variable now what we have to do we have to show this result in this result text view so for that what we will do after this switch case that means when after this what we will do result text View dot in Java we have dot set text but here we can directly write text equals to result we can concatenate it like result is we can specify a dollar result so in this way we can see the result in result text View so if we summarize is what we have done is we have just initialized the variables all the views and we have given the ID but I have forgot to assign ID to these views let's do that also ETA equals to find view ID r dot ID dot ETA the same way e t b equals to B result TV equals to foreign I guess let's go to our view result ID will be result TV so here result TV so in this way we have assigned the ID as we do in Java and on click of any button we have assigned the values to A and B and then we have stored the value in result and in the result text here we have just displayed the result that's it let's run it and test it once so our application is running let's give the input as 10 and B as 5.
วิดีโอที่เกี่ยวข้อง
Learn Kotlin in 12 Minutes
12:01
Learn Kotlin in 12 Minutes
Rahul Pandey
323,509 views
The Jetpack Compose Beginner Crash Course for 2023 💻  (Android Studio Tutorial)
48:28
The Jetpack Compose Beginner Crash Course ...
Philipp Lackner
263,954 views
🔥 How to Create Your First Android Application with Android Studio | Tutorial for Beginners
28:58
🔥 How to Create Your First Android Applic...
SkillsBuild Training
73,888 views
Kotlin Crash Course
1:23:50
Kotlin Crash Course
Traversy Media
253,331 views
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kotlin Multiplatform vs Flutter: Which sho...
Kei Fujikawa
21,720 views
The FULL Beginner to Pro Roadmap for Android Development in 2023
10:47
The FULL Beginner to Pro Roadmap for Andro...
Philipp Lackner
256,467 views
Kotlin in 100 Seconds
2:22
Kotlin in 100 Seconds
Fireship
1,225,059 views
Creating First Application In Android Studio in 2024
9:59
Creating First Application In Android Stud...
Codes Easy
1,090,889 views
I Created A Mobile App Using These Simple Tools!
10:48
I Created A Mobile App Using These Simple ...
Simon Grimm
692,426 views
Build an iOS & Android app in 100% Kotlin with Compose Multiplatform
50:42
Build an iOS & Android app in 100% Kotlin ...
Kotlin by JetBrains
144,713 views
Kotlin Course - Tutorial for Beginners
2:38:31
Kotlin Course - Tutorial for Beginners
freeCodeCamp.org
1,691,679 views
Android App Development Tutorial for Beginners - Your First App
55:20
Android App Development Tutorial for Begin...
freeCodeCamp.org
397,499 views
Don't Learn Machine Learning, Instead learn this!
6:21
Don't Learn Machine Learning, Instead lear...
Deepchand O A
3,659 views
How to manage State in Jetpack Compose 🚀 | Android Studio | 2024
13:23
How to manage State in Jetpack Compose 🚀 ...
Easy Tuto
5,256 views
How ChatGPT Built My App in Minutes 🤯
8:28
How ChatGPT Built My App in Minutes 🤯
Website Learners
2,449,733 views
Build and Publish an Android App - Full Course with Kotlin
4:25:57
Build and Publish an Android App - Full Co...
freeCodeCamp.org
352,735 views
Online Coffee Shop app Android Studio Project with Firebase & Kotlin- android studio Koala
2:31:17
Online Coffee Shop app Android Studio Proj...
UiLover Android
8,127 views
Kotlin Tutorial For Beginners 2023
4:54:12
Kotlin Tutorial For Beginners 2023
Amigoscode
135,816 views
Front-end web development is changing, quickly
3:43
Front-end web development is changing, qui...
Fireship
996,998 views
Kotlin Multiplatform Mobile: Make Cross-platform Movie app - Part 1 Shared Code
53:19
Kotlin Multiplatform Mobile: Make Cross-pl...
Mr Dip Coding
25,092 views