After learning a few (mostly web) frameworks over time, with Django powering most of my every day work in the past few years, and playing with iOS a few years back, I finally started spending some serious time learning Android.
I've been using a few resources, including Udacity's Android course targeted at non-beginners, and the great and constantly updated Android guide and reference at Commonsware.com.
Being used to understanding framework internals it's pretty hard going back into treating most of a (huge) framework as more or less a "black box". This is potentially unavoidable when you first start learning something, as you have to break it down into levels:
Udacity's program is interesting as they make you work on a side-project/assignment, as you're progressing through the course, which requires you to develop an app from scratch, given specific requirements (a simple movie recommendation app).
I'm currently working on that and it greatly frustrates me that I don't yet have a good picture of what the framework really does under the hood, but I'm positive that I'm learning quite a lot in the process!
To be continued :)
Turns out if you use Picasso to load images from URLs into your views it might silently not load them if you don't have internet permissions:
<uses-permission android:name="android.permission.INTERNET"/>
A bit of a Java refresher, this is a thing that's actually fairly different from Python.
Even where logically in Python a variable would always be defined when it is accessed further down in the flow of your program, the Java compiler will not necessarily agree with you:
(this isn't just a code inspection thing, actually trying to compile this will report the same error).
This might be annoying in some cases but it makes sense the way that scopes work in Java:
foo
is declared and only lives inside the try
/except
/finally
blocks. It's a local variable
and therefor inaccessible anywhere else.
The solution would be to declare the variable outside of these blocks:
The function will the normally return "boom"
as the it's set in the finally
statement :)
Sometimes deciding whether to use fragments vs activities and their infinite combinations for layout and navigation feels really daunting.
Things get even more complex when you want to support different layouts based on screen size/orientation.
This guide, which is similar to the official documentation, was particularly useful for using combinations of activities and fragments.
There are, however, people who advocate against using fragements, and it's also very interesting to see what they have to say (in this example coming from the Square tech blog).
There are practical alternatives to using fragments all over the place, such as the Pankcakes library.
I wonder whether a language will ever exist that has good, in-built support for datetime objects.
So here's the latest gem I discovered in util.Date
:
So basically getYear() returns 116 for this year (2016). I don't know who would use it today, or why it was ever built like that, or what sort of backwards compatibility demon forces us to keep it there.
D:
Apparently people these days use things like Joda.