Android Studio Tutorial - Part 2 (2019 Edition)

preview_player
Показать описание
An Activity is another term for a screen. In this tutorial, let's make the Button do something. In Android Studio, we need to give the Button and ID that is different from all other Buttons.

Let's write something to Logcat for debugging. In the next video, we'll add the Activity to the Manifest and write Kotlin code that takes the user to a new Activity when the Button is pressed.
Рекомендации по теме
Комментарии
Автор

everyone who have problems with tag: and msg:
1) make sure that you "import android.util.Log.d"
2) try to erase "tag:" and it will replace it and "msg:" with gray ones

vanxthenecron
Автор

If anyone is still having trouble with the "tag and msg" situation. Make sure you have 'import android.util.Log.d' typed at the top of the program. Also instead of typing out "tag" or "msg", start by typing "d", then tab with the first autocomplete selection, then Just type a set of double quotes and type your tag in there. The grey "tag" will automagically show up before the quotes. Repeat this step for the msg. Don't type the words, just let it autocomplete for you.

VerresInvictus
Автор

You're the only Android Dev on YouTube that uses Kotlin and uploads tutorials that are right to the point and easy to understand. Super useful for people that are getting into Android development through Kotlin, like me! Definitely a huge jump from Front-end web development, that's for sure 😆

Btw, just wanted to say thank you for all of your tutorials. Can't wait for future uploads!

JoshuaChew
Автор

Thank you for "getting rid of the stuff we don't need" that was by far the most helpful initial step

brockobama
Автор

every having problems with d(tag: "Daniel", msg: "button was pressed!")
I just used this instead: println("button was pressed!")
👍awesome tutorials, Daniel! having fun, staying fascinated, getting skilled! yeaboi

dcdales
Автор

i realise this is old, but for the life of me i cannot get the bigButton ID to call in the script, it just keeps coming up red. What am i doing wrong?

markdarling
Автор

For all those who still have an issue with tag/msg part - on November 2019 version this should look exactly like this:

bigButton.setOnClickListener { it: View -> d("whatever you wish", "bigButton has been pressed")} .

What I've changed is no "tag" and no "msg" in the code. You also do not put "!" after "View", istead replace it with "->" (just beggining with Android Studio, I have no idea would it actually make a difference in the future but for now it's enough to run the code.

And here You have required imports (top of the program):
import android.os.Bundle
import
import android.util.Log.d
import android.view.View
import
import

maciejsmiechowicz
Автор

all this is new to me, but you are making it easy to follow and understand. Thanks

elneno
Автор

Expecting ')'
Unexpected tokens (use ';' to separate expressions on the same line)
Missing '}
None of the following functions can be called with the arguments supplied:
public open fun d(p0: String!, p1: String!): Int defined in android.util.Log
public open fun d(p0: String!, p1: String!, p2: Throwable!): Int defined in android.util.Log
Unresolved reference: tag

> Task :app:buildInfoGeneratorDebug


Nice first program!:D No idea how to even run it:D

Jab_hutt
Автор

This is for anyone having a problem with the emulator. There is a app called sidesync you can install on your android phone and your computer that works great, you can use your phone as the emulator. It takes a little fooling around to get it running and understand it, but it bypasses all the short comings of your computer! I hope this helps anyone getting frustrated trying to get the emulator to run! Never give up!

williamclarkson
Автор

Well... After part 1 I came for part 2. I understand it's a video targeting begginers... But there's a lot of "kind of" and "lots of stuff" that should have been explained as libraries, properties. And clicking and seeing "lots of code" is not quite explaining... Manifest exists for a reason and purpose. As content_main, and every else. Keep it up. Hope you don't mind some critics...

antoniopedrolima
Автор

OK Im going to watch all parts of this series now :)

Pokeccc
Автор

Right from the beginning: bro explain why you delete code other than "we don't need it" why do we not need it!? Also what does the d(...) method do?

supernenechi
Автор

To anyone viewing this now, deleting tag: and msg: then saving will autocorrect it!

chulzzz
Автор

he sounds like Bill Lumbergh from Office Space.
Yeaaah, what's happening here... yeah .. am gonna need you to click here. yeaaah

stewiegriffin
Автор

Hey daniel, @2:53 after I write my name, the "tag" and "msg" do not show up, and when i write them manualy, they become red and the "d" also stays red. How do i fix that?
thanks

watchlearn
Автор

my version doesn't have setSupportActionBar(toolbar); throws an error when I enter manually

Ejeby
Автор

I am having no issue keeping up with the video. However, every few times that I click bigButton, I get the following message:

2019-08-25 11:21:29.213 I/zygote: Do partial code cache collection, code=29KB, data=30KB
2019-08-25 11:21:29.214 I/zygote: After code cache collection, code=29KB, data=30KB
2019-08-25 11:21:29.214 I/zygote: Increasing code cache capacity to 128KB

Looks like a cache issue. Any suggestions?

charleslamoureux
Автор

If you get Couldn't load memtrack module then use Log.d instead of just d

chulzzz
Автор

I was able to write tag and msg fine, but it wont show the log on logcat with my name and etc. Did I do something wrong? When I press the button it sounds but i just dont see anything

justinchun