# Your First Kotlin Android App - Part 22: Adding | Ray Wenderlich

**URL:** <https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513>\
**Category:** 🎓 Courses & Articles\
**Created:** [March 20, 2018, 3:45pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513 "2018-03-20T15:45:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [March 20, 2018, 3:45pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/1 "2018-03-20T15:45:14Z")

</div>

Learn about properties and how to add them to an activity.

* * *
 This is a companion discussion topic for the original entry at [https://www.raywenderlich.com/4738-your-first-kotlin-android-app/lessons/22](https://www.raywenderlich.com/4738-your-first-kotlin-android-app/lessons/22)

---

<div class="post-metadata">

**Author:** ![darrinps](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/darrinps/32/81494_2.png) [@darrinps](https://forums.kodeco.com/u/darrinps)\
**Post date:** [March 28, 2018, 2:31am UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/2 "2018-03-28T02:31:42Z")

</div>

Kind of surprised you make the folks learn about findViewById when you have the the kotlin-android-extensions at their disposal. So, instead of doing what you did you could have just had them reference the widgets directly via their name…game\_score\_text\_view for example.

---

<div class="post-metadata">

**Author:** ![vegetarianzombie](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vegetarianzombie/32/94022_2.png) [@vegetarianzombie](https://forums.kodeco.com/u/vegetarianzombie)\
**Post date:** [March 28, 2018, 1:20pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/3 "2018-03-28T13:20:28Z")

</div>

We actually do that in later series. This is just one method to get them started.

---

<div class="post-metadata">

**Author:** ![darrinps](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/darrinps/32/81494_2.png) [@darrinps](https://forums.kodeco.com/u/darrinps)\
**Post date:** [March 29, 2018, 2:18am UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/4 "2018-03-29T02:18:19Z")

</div>

Gotcha. Thanks for explaining.

---

<div class="post-metadata">

**Author:** ![mar\_ast74](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@mar\_ast74](https://forums.kodeco.com/u/mar_ast74)\
**Post date:** [November 21, 2018, 8:42pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/5 "2018-11-21T20:42:12Z")

</div>

Why is my “internal” and "var " red in the mainActivity codes??

---

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [November 25, 2018, 9:22pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/6 "2018-11-25T21:22:49Z")

</div>

It sounds there is an error occurring. Typically, when you see red in any code editor then you are making a mistake or the code can’t figure out what is happening. Is you statements inside the class definition? That’s the first thing I’d check.

If so, feel free to paste the code here and I’ll take a look. Thanks!

---

<div class="post-metadata">

**Author:** ![mar\_ast74](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@mar\_ast74](https://forums.kodeco.com/u/mar_ast74)\
**Post date:** [November 26, 2018, 5:23pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/7 "2018-11-26T17:23:06Z")

</div>

![Sk%C3%A4rmklipp](https://files.chunter.kodeco.com/original/3X/c/b/cb93133795bfd3e5651dff7a69bc99e1a1449ec4.png)

This is how it looks like right now.  
Can I restart my MainActivity or something?  
So I can get It back to original.

---

<div class="post-metadata">

**Author:** ![bdmoakley](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/bdmoakley/32/108772_2.png) [@bdmoakley](https://forums.kodeco.com/u/bdmoakley)\
**Post date:** [November 26, 2018, 5:58pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/8 "2018-11-26T17:58:34Z")

</div>

It looks like you are missing your opening brace . Add the opening brace at the end of the class definition line or underneath it. That is, the line that reads: “class MainActivity extends …”

That will resolve all your errors. I hope that helps!

---

<div class="post-metadata">

**Author:** ![marathoner1234](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/marathoner1234/32/110937_2.png) [@marathoner1234](https://forums.kodeco.com/u/marathoner1234)\
**Post date:** [February 22, 2019, 4:24pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/9 "2019-02-22T16:24:06Z")

</div>

I think Android Studio/Kotlin has been improved such that type inference is better. I get a warning in the OnCreate method when I add the type to the findViewById call (findViewById\<Button\>, etc.)

---

<div class="post-metadata">

**Author:** ![shogunkaramazov](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/shogunkaramazov/32/108826_2.png) [@shogunkaramazov](https://forums.kodeco.com/u/shogunkaramazov)\
**Post date:** [February 22, 2019, 4:39pm UTC](https://forums.kodeco.com/t/your-first-kotlin-android-app-part-22-adding-ray-wenderlich/40513/10 "2019-02-22T16:39:00Z")

</div>

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]
