1

What's the best way to start learning Android XML + Java tech stack?

Profile picture
Mid-Level Software Engineer at Seed Stage Startup6 months ago

I have worked primarily on the backend, but my company now has assigned me features concerning our Android app, which is built mainly on XML for layouts & Java.

How can I get started on this, be productive & contribute effectively?
Thanks.

74
9

Discussion

(9 comments)
  • 4
    Profile picture
    Staff Eng @ Google, Ex-Meta SWE, Ex-Amazon SDM/SDE
    6 months ago

    Do you know Java? If not, start there. Have you worked in any other iterative, C-style language? And/or modernish OOP language? If yes to those, it shouldn’t be hard.

    I actually don’t know the right way to start learning Java. I imagine looking at existing code and solving problems you’ve already solved in the language. I guess you explicitly mention Java, but… are y’all not using Kotlin? I don’t know that it’s easier to learn than Java, and if there’s an existing codebase with Java I guess even if you focus on Kotlin it won’t be all you need.

    OK, so Java… language-wise, not complex. More involved in my opinion, is the Android framework and specifically managing lifecycles of various elements. Fragments, Activities, Views, like… understanding when to do what, and also what must run on the UI thread, and how you bounce things off that thread to do something heavyweight, that then uses a callback or other redirection to update the UI back on the UI thread. I would say that asking someone that’s familiar to show you examples in the codebase would help, and just reading the Android documentation.

    From there, I’d try to work on existing code, fixing some bugs and things. Maybe small feature changes, but not tremendous changes to UI Views. Make sure you can make your way around the app, see how network calls happen, how that makes its way to the UI. If your team uses MVVM or something, learn about where the models are, Views, and ViewModels. Maybe learn 3 things about a more exotic UI element like a RecyclerView.

    Only when you can do the rest of this should you get involved in actual UI changes via XML. I got confused at first because while they definitely are XML I guess I always felt like I couldn’t make sense of XML and the docs for Android make it not very hard. Again, find out from your team how much is done in the xml and how much is done in code.

    Is the expectation that you pitch in for a few weeks, or take a major role in Android dev? This could be over investment if it’s short term.

    I think Rahul used to teach Android dev? And likely has YouTube videos?

    • 1
      Profile picture
      Tech Lead/Manager at Meta, Pinterest, Kosei
      6 months ago

      I did! But I taught almost entirely in Kotlin. IMO it's undeniably a better developer experience, and companies will slowly start to migrate over.

      If you want to check out what I made, here's what I recommend:

    • 0
      Profile picture
      Mid-Level Software Engineer [OP]
      Seed
      6 months ago

      Thanks Lee & Rahul

  • 3
    Profile picture
    Sr. Software Engineer at LinkedIn
    6 months ago

    Adding some thoughts over Lee's suggestions:

    1. Resources: Android development is vast and fragmented. For a long time, Google has kept introducing new things and deprecating existing things. There are tons of content on the web, but I would recommend some hands-on with the Google codelabs starting with something like this. After this, you can start to have a look at your company's codebase to understand the common Views like ConstraintLayout, lifecycle handling, architecture components, networking etc.
    2. Iterate: Android development is notorious in the sense that you need to handle a lot of things which may not come naturally. Like user rotates the screen (called configuration change), ideally there shouldn't be anything for the developer to do but you have to persist data and it isn't trivial. Get started with codelabs or small tasks and iterate on it. Learning all at once might be an overkill.
    3. Physical Device: Android Emulator works just fine but can heat up the system and hamper the performance. Considering this fact + Android builds taking a lot of RAM, using a physical device for testing can provide significant speed boost.
    4. Use Github Copilot: It can provide some productivity boost where the operation seems trivial like iterating over the list, creating a TextView, creating an adapter etc. You can simply comment your ask like the following. It will generate the boilerplate code which would save some time. It may not work in every scenario but worth giving a try.
    // create a RecyclerView adapter
    class Adapter: RecyclerView.Adapter<RecyclerView.ViewHolder>() {
    
      protected fun getView(@LayoutRes layoutId: Int, parent: ViewGroup): View {
         return LayoutInflater.from(parent.context)
                              .inflate(layoutId, parent, false)
      }
    }
    

    Is your company/team moving to Kotlin? As Rahul also mentioned, it's definitely a better choice for developers. If your team is aligned and you will be doing Android development in the long term, you can start with Kotlin as well.

    • 0
      Profile picture
      Mid-Level Software Engineer [OP]
      Seed
      6 months ago

      Thanks Paras

  • 2
    Profile picture
    Friendly Tarodactyl
    Taro Community
    6 months ago

    my company now has assigned me features concerning our Android app

    It depends on your experience with onboarding new languages. If you have some precise tasks in mind, I'd just go dive into the tasks and see what's needed to be done and what's confusing about the code base. Then you can start from there.

    If your project is in Kotlin, it might be helpful to learn some basic Kotlins from the ground up because the language is a bit different from Java/C/C++. For me, the variable name / type ordering annoyed me for a few weeks. Also it wasn't straightforward for me to write idiomatic Kotlin coming from Java/C++ background, so it's good to find some good files / examples in your repo to learn from

    • 0
      Profile picture
      Mid-Level Software Engineer [OP]
      Seed
      6 months ago

      Thanks!

  • 1
    Profile picture
    Tech Lead @ Robinhood, Meta, Course Hero
    6 months ago

    Java and XML are old-school, so the benefit there is that there's tons of resources online about it. This also means that ChatGPT has a ton of training data, so it should be tremendously helpful for basic tasks. If this is a short-term situation (i.e. you won't be working on Android for very long), then it's totally fine just copy-pasting code snippets from ChatGPT and not having to fully understand them.

    Here's another great thread about learning Android: "How can I get really good at Android?"

    We have a system design course that is mobile-focused as well, which will help you write great mobile code in general: [Course] Frontend System Design Masterclass - Building Playlists

    Lastly, I recommend writing new code in Kotlin if possible as Kotlin is very stable now and definitely better than Java.

    • 1
      Profile picture
      Mid-Level Software Engineer [OP]
      Seed
      6 months ago

      Thanks Alex

A startup or start-up is a company or project undertaken by an entrepreneur to seek, develop, and validate a scalable business model.
Startups291 questions