Alex Collins is a enterprise Java developer and currently works in the UK. He has worked in the insurance, publishing, telecoms and supply chain. In his spare time he codes in Python, Clojure and Scala (but not at the same time) and enjoys a multitude of sports. His catchphrase is K.I.S.S! Alex has posted 20 posts at DZone. You can read more from them at their website. View Full User Profile

Android Basics Refresher

10.23.2010
| 7145 views |
  • submit to reddit

Covering the fundamentals of the hottest platform in mobile right now.

Reading through my Android notes today, I realised the quick-read format might be useful to others. Although fellow zoneleader James has been featuring some excellent articles on Android, I'd thought give my take in a simpler format - just in case it triggers your memory.

Android Basics

Every app;

  • runs in its own Linux process
  • shutdown when more resources needed
  • each process has its own VM
  • assigned its own user ID so its data is visible only to that user (and app)
  • can call upon components developed elsewhere to allow for reusability
Activity

An activity is a UI representing a task the user wants to perform, such as entering a phone number into a text-box, or a list of menu items the user must choose from. Applications are made up of many activities. A Java class must extend the Activity class.

Views, or 'widgets', are what make up the components in an activity. As subclasses of View, these represent standard items in a UI such as a button, textbox or Image.

Services, Broadcast Receivers and Content Providers Services

Run in the background. Extend the "Service" base class. The platform will start them by passing Intent to Context.startInstance(). "onStart()" will be called by Android on the instance of a new Service and an Intent passed to it. To get a hold of an established Service (i.e. one that's already running), you can call Context.bindService(); in such a scenario the Service is given an Intent instance and its onBind() method is called.

Broadcast Receivers

Receive and react to broadcast announcements. Examples would be battery is low, or the language has been changed. Extend BroadcastReceiver base class. They do not have a an interface and typically display an icon in the notification area.

Content Provider

Exposes one application's data to another. An extension of ContentProvider, these act on calls from ContentResolver (which other apps invoke) to access data controlled by this provider.

Intents

Activities are started by passing Intent instances to Context.startActivity() or Activity.startActivityForResult().

I hope that helps someone out there!

Published at DZone with permission of its author, Alex Collins.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Jose Asuncion replied on Mon, 2010/10/25 - 8:12am

Great refresher! I have just been reading the tutorials on Android but not actually doing them so this article explains some concepts in a simple manner. "each process has its own VM" I haven't developed in Android and I am curious if each VM can be fine tuned to indicate for example how much memory it can consume.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.