- Activity: http://developer.android.com/reference/android/app/Activity.html
- Intent: http://developer.android.com/reference/android/content/Intent.html
- Directory structure
- Most code lives in
src/main/java
- Other languages will live in
src/main/${LANGUAGE_NAME}
- Typically includes stuff like protobufs or thrift, which might generate code usable from other classes in main
src/main
for stuff to go in the app;src/test
is structured the same except it has testing stuff.- Stuff in
src/test
typically can see into src/main.
- Stuff in
- This directory structure comes from Maven, which is a really solid, if not the most solid dependency/package management software for any language that runs on a VM...
- ...but it's quite complex the more plugins you add to it and configuration is insanely verbose, so Android uses Gradle, which uses the same directory structure and produces compatible build artifacts, BUT has much easier and simpler configuration (i.e. not XML, lol)
- Most code lives in
- Square has the most interesting/useful Android code. Haven’t really looked at FB’s Android code, but it’s likely rather good. Google can be hit or miss. While most of Google is superlatively excellent, their execution on mobile is often good, but lacking.
- Square lured some top-level Android people away from Google some time ago, and I’m sure FB did too.
- Support Library: Probably use. If you’re targeting old android platforms, almost certainly use. If not, I’m not sure it’s necessary; might want to ask someone more current.
- Fragments: Don’t use. Unless, for some reason, you need to and can articulate why. https://corner.squareup.com/2014/10/advocating-against-android-fragments.html
- Data Binding: Maybe use. It generates code at runtime, though. http://developer.android.com/tools/data-binding/guide.html
- Dagger: Suggested, but not required. Dependency Injection for Android. You might want to wait until you’re used to Android code written without it. If you’re not planning for the long term, or just doing something quick and dirty, go ahead and make a mess and forget about this. http://google.github.io/dagger/
- HTTP Libraries: Use Retrofit and OkHTTP. OkHTTP, written by square, was good enough that it now powers Android’s HTTP stack. Retrofit, also Square, is a nice layer on top.
- I haven’t vetted these as much as the stuff above, but FWIW, it might be good to read.
- Explaining Dagger/how to use it: https://medium.com/@patrykpoborca/making-a-best-practice-app-4-dagger-2-267ec5f6c89a#.ijwgidvmg
- Tests & some small blurbs about architecture: https://medium.com/@patrykpoborca/making-a-best-practice-app-5-clean-architecture-testing-84a1672dd000#.1nd7unref
- Repo with example code using Dagger & stuff: https://github.com/patrykpoborca/CleanArchitecture
- I'm not religious about Android architecture (hard to be; I've left it behind), but this series of posts looks interesting: http://luboganev.github.io/blog/clean-architecture-pt1/. It might be heavy in places, though. It links to https://github.com/square/mortar and https://github.com/square/flow, both Square libraries, so I'm inclined to think it'll be enlightening in some way. It has a repo with source here: https://github.com/luboganev/Carbrands