Tuesday, May 31, 2011

Follow the Blog

Well, I haven't been having the best couple of weeks recently. If you like the tutorials and want to help cheer me up, follow the blog! Or leave some comments if you like.

Thursday, May 26, 2011

Android 9 Patch Image Tutorial

This tutorial describes what Android 9 patch images are, how to make them, and how to use 9 Patch images in Android applications.

What is a 9 Patch Image?

A 9 patch image is an image that has stretchable areas defined.

These areas are defined in a special 1 pixel wide border around the area. Add black pixels to the top and left of this border to describe where the image can be stretched horizontally and vertically.

Why Use 9 Patch Images?

Nine patch images are especially useful when designing buttons. Custom drawn buttons can look distorted and pixelated when their borders are stretched in addition to the rest of the image.

Take a look at the Custom Drawn Button tutorial to see how using 9 Patch images can be used to create a button, and what happens if they aren't used.

Creating 9 Patch Images

Making a 9 Patch image is a fairly easy process. Included as part of the Android SDK is a Draw 9 Patch utility. Navigate to the folder where you installed the SDK. From there navigate to the tools folder. Inside this folder will be the draw 9 patch program. On Windows, double click on draw9patch.bat

The draw9patch.bat file

Wednesday, May 25, 2011

Creating a Custom Drawn Button for Android

Through this tutorial you will learn how to create a custom drawn button, and learn how to use that button in an application.

Why Create a Custom Drawn Button?

If you ask me, I feel like the default button drawing for Android makes the entire OS feel a bit like Windows 95. The button doesn't really look that different--it is basically the same plain boring gray.

Having a boring gray button can be an advantage. It instantly sticks out to most users and can be easily identified as an element that you can click. The other advantage is that it is the default button style and very easy to use and maintain.

Two buttons with the default drawing style


There are also many advantages to using custom drawn buttons. You can use colors that better fit with the palette of your app, make buttons more distinguishable from each other, and give your app a more unique feel that helps separate it from the rest of the crowd.

Wednesday, May 4, 2011

Introducing the Tic Tac Toe Tutorial

This blog post introduces the Tic Tac Toe tutorial and provides links to the other parts of the tutorial, as the tutorial itself is fairly long.

Screenshot of the finished Tic Tac Toe product

Why Build Tic Tac Toe?

I can think of a number of good reasons. Maybe building Tic Tac Toe isn't your ambitious Android app goal, but by following this tutorial you will be introduced to a number of concepts that you can reuse and apply. And hopefully playing it can be a little fun.

Also, Tic Tac Toe is a great game to build because its a medium sized project. Not too lengthy and complex but not exactly trivial either. For this reason, the Tic Tac Toe tutorial will be broken down into a couple of blog posts.

Defining the Game
Before we actually get to the programming of the Tic Tac Toe game, lets set up some ground rules.
  1. The game logic must be completely separate from the Android specific display logic
  2. The player will only play against the computer
  3. The player will always be X, the computer O
  4. There app will be limited to one activity, with one XML layout
  5. There will be two levels of difficulty

The Final Product
As you read this, the final product is already available for downloading and testing on your Android Device. Check it out on the Android market with the following link: https://market.android.com/details?id=com.dreamdom.tictactoe

Other Posts in the series
Android Tic Tac Toe Game Logic - Part 1 Interfaces

Sunday, May 1, 2011

Creating an Android Calculator Tutorial

Through this tutorial you will learn how to develop and code a simple calculator in Android. Topics covered will include using a webview, layouts, and button listeners.

Introduction

One of the cool things about having a smart phone is knowing that you will always have a calculator handy. If you need to total receipts, perform some supermarket comparisons, or calculate tips or percentages on the fly a calculator is definitely a handy tool.

Screenshot of the calculator tutorial
However, the basic calculator app that comes preloaded with the Android Operating system leaves a lot to be desired. Perhaps you want to build your own more advanced calculator. You can use this tutorial as a starting point.