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.
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?
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:
Thanks Lee & Rahul
Adding some thoughts over Lee's suggestions:
// 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.
Thanks Paras
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
Thanks!
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.
Thanks Alex