Archive for the 'Tutorials' Category

Android Application Lifecycle Demo

An excellent video on Android’s application lifecycle has been posted today by Sleepy Droid:

Demo video here

I thought I already knew everything about Android’s app lifecycle, but this visual refresher and sample application were a great refresher. Understanding the application lifecycle is crucial to writing good Android apps so this video shoud be useful to pros and newbies alike.

Sleepy Droid says they’ll be creating more videos if the response is positive so visit Sleepy Droid to see if new videos have been posted.

Thanks Sleepy Droid!

Android Tutorial #4.2: Passing custom attributes via XML resource files

In tutorial #4.1, I mentioned that we passed custom attributes for the text and image variables from the XML resource file to our custom class. This is a critical skill for performing true object-oriented programming and how to do it wasn’t obvious from Google’s Android API Demos.

Luckily I was pointed to the solution myself by an experienced Android programmer in Guatemala by the username of cadlg (thanks again!). If you want to see the official Google Android example though, look at Android’s APIDemos’ custom LabelView example.

So here we go. We’ll use the same code as Tutorial 4.1 to keep this simple.

Continue reading ‘Android Tutorial #4.2: Passing custom attributes via XML resource files’

Android Tutorial #4.1: Image & Text-Only Buttons (UPDATED)

This very simple tutorial will add to your Android UI (user interface) development arsenal. How? Buttons that display as simple text or as images are basic elements of any application. By following the two steps below, these buttons can be easily created with Google’s Android by simply extending the current Button and ImageButton classes.

We will create these two new Button extensions as shown:

Text and Image Buttons

Continue reading ‘Android Tutorial #4.1: Image & Text-Only Buttons (UPDATED)’

Android Tutorial 3: Custom Audio Streaming with MediaPlayer

Introduction

NOTE: This tutorial was written for Android v1.0.  I have just updated the Android streaming media player tutorial/code to v1.5 (Cupcake) with some additional information on the updated code.  You should read that post as well as this one.

This is a long tutorial, but for those of you that have been struggling with streaming of .mp3 audio to Google’s Android’s MediaPlayer, then I hope this tutorial proves useful as you finalize your entries into Google’s Android Challenge

This tutorial will show how to roll your own streaming audio utility for Android’s MediaPlayer. We will buffer 10 seconds of audio and start playing that audio while the rest of the audio loads in the background. We store the streamed audio locally so you could cache it on device for later use or simply let it be garbage collected.

Here’s the source code for those that just want to jump in. You’ll also notice code for the other tutorials as I didn’t have time to strip them out.

Here are a few screenshots of what we’ll be creating:

Tutorial #3 results screenshots

Continue reading ‘Android Tutorial 3: Custom Audio Streaming with MediaPlayer’

Android Tutorial 2: “Hit” testing on a View (MapView)

The following tutorial addresses how to perform ‘hit’ testing for user ‘clicks’ in a View. By hit testing, we mean the ability to determine when a user’s selection of a specific Point in a View overlaps with a region that we are monitoring for further action.

In other words at the end of this MapView tutorial, your users will be able to click on any icon that you draw onto the map, and you’ll be able to take whatever action you like such as displaying a transparent popup window (as we do in the tutorial).

Here’s what the final result will look like:

Screenshot of Tutorial 2 results

Continue reading ‘Android Tutorial 2: “Hit” testing on a View (MapView)’

Tutorial 1: Transparent Panel (Linear Layout) On MapView (Google Map)

This tutorial is for Google’s Android mobile operating system. If you haven’t already heard about Android, then check it out immediately because it’s way cool. We have benefited so much from the Android developer community that we want to give back our own insights into the platform and how to better design/develop on the platform.

For this tutorial, we’re going to help the several people that have asked us how to create transparent panels. While we show how to overlay onto a Google Map, you can use the same technique to overlay a transparent panel onto any other view.

Starting at the end, this what we’ll develop today – a transparent panel with a single button displayed at the base of an Android MapView

Tutorial 1 - final result

Tutorial 1 - final result (closeup)

Continue reading ‘Tutorial 1: Transparent Panel (Linear Layout) On MapView (Google Map)’


a