Over a million developers have joined DZone.

Android Basics Refresher

· Java Zone

Easily build powerful user management, authentication, and authorization into your web and mobile applications. Download this Forrester report on the new landscape of Customer Identity and Access Management, brought to you in partnership with Stormpath.

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!

The Java Zone is brought to you by Stormpath—a complete, pre-built User Management API. Want to learn how to use JWTs to protect microservices from CSRF and more? Check out this on-demand webinar with our Java Developer Evangelist, Micah Silverman.

Topics:

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}