[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

DEV Community

Cover image for Day Four of Becoming an Android Developer
Himanshu Gaur
Himanshu Gaur

Posted on

Day Four of Becoming an Android Developer

Day 4: Becoming an Android Developer – Mastering Lists and Objects with Kotlin

It's Day 4 of my journey to becoming an Android developer, and I’m thrilled to share what I’ve learned! Today was a big leap in understanding the core concepts of Kotlin, thanks to my instructor, Sir Denis Panjuta, who guided me through Lists and Objects. With these essential building blocks, I feel much closer to being ready to start building real Android apps.

Understanding Lists in Kotlin
One of the key topics we covered today was Lists. At first, Lists might seem similar to arrays or vectors from C and C++, but there's an important distinction. While an array is a fixed-size structure, a List in Kotlin is more flexible and can dynamically grow or shrink as needed. The concept is still very familiar—it's essentially a collection of items that you can access by their index, but it’s more versatile and easier to work with in Kotlin. Lists are powerful because they allow for a wide range of operations like adding, removing, and modifying items without worrying about fixed sizes.

Diving into Objects and Classes
The other topic that really stood out today was Objects and Classes, even though I had learned about them in a previous class. In object-oriented programming (OOP), an object is an instance of a class. This means that once you define a class, you can create multiple objects from it, each with its own properties and methods. This concept allows for cleaner, more modular code, and it's the foundation for organizing functionality in any Android app.

Today, we built a simple BankAccount program, which was a fun and educational exercise. The BankAccount class included four core functions:

deposit

withdraw

accountBalance

displayTransactionsHistory

Each function demonstrated how to interact with Lists, work with objects, and manage data. It was a great way to practice Kotlin syntax and understand how to manage the state within an app.

Creating the BankAccount Program
The BankAccount class had some key features that helped me solidify my understanding of Lists and Objects:

  • Deposit:
    Added money to the account, which involved updating the balance.

  • Withdraw:
    Subtracted money from the account, with a check to ensure there was enough balance.

  • Account Balance:
    A function to get the current balance of the account.

  • Display Transactions History:
    A list that stores the transaction history, which could be displayed to the user.

This hands-on project not only helped me practice Kotlin syntax but also showed me how objects can interact with each other. I’m now comfortable with creating classes, defining properties, and working with Lists to track multiple values.

Looking Ahead: Building My First App Tomorrow
With Kotlin basics almost complete (though there’s still much more to learn), I’m feeling confident about diving into Android app development. I’ve got a solid foundation in Lists and Objects, which are fundamental concepts in Android programming, and I can’t wait to start building my first app tomorrow. I’m excited to see how all of these concepts will come together in a real-world application!

Today’s lessons have not only expanded my knowledge but have also boosted my excitement for what's to come. The road to becoming an Android developer is long, but each day I’m making progress. Can’t wait to see what tomorrow brings!

Stay tuned for the next update
Image description

Top comments (0)