Google Android Translation Guide

by

If you are new to Android programming, you will find there are a few ‘new’ concepts and paradigms to learn. There are fancy new terms such as ‘Activity’ and ‘Intent’. Rest assured, most of these expressions are just Google trying to put their own stamp on some pretty tried and true programming paradigms.

I’ve prepared a ‘translation guide’ to help those coming to Android from web or iOS programming, where more standard terminology prevails. Here are some translations:

Activity == View Controller. An activity is essentially a view controller. It has a few extra bells and whistles, but at the end of the day it is used to control a view.

Intent == Message.  An Intent is something that other objects listen for and respond to, such as Services, Activities and Broadcast Receivers. They are basically messages that support a custom payload.

One interesting thing about Intents is that they come in two flavors, explicit and implicit. Implicit Intents do not name a target and can be used to launch actions in other applications. The Android system find the best component to handle the message, er, Intent.

Gravity == Alignment.  Gravity is a replacement for horizontal and vertical alignment in Android styling/layout. It combines the two into one entity, so you get ‘gravities’ like ‘center_vertical’ and ‘center_horizontal’. There is gravity, which controls the layout of a component’s children, and layout_gravity, which controls the layout of a component within it’s parent. Make sure you choose the right gravity for your planet; oops, I mean component.

Fragment == Component. A Fragment is essentially a component of an Activity. Fragments have essentially the same life cycle as an Activity, but they must reside within a parent Activity. Fragments were created to support reusable components with the release of Android tablet devices.

Inflate == Deserialize. AS you start writing Android view code, you’ll see ‘inflaters’ (LayoutInflater and MenuInflater, for example) that are used to create View objects. There is more going on under the hood, but basically inflating is turning for XML layout definitions into View objects.

I hope this helps demystify some of these terms. If you have more to add to the list, please let me know!

Leave a Reply

Your email address will not be published. Required fields are marked