Saturday, May 25, 2013

How to Download and Install Android Studio

This article describes how to download and install the 0.1 version of Android Studio on a Windows 7 computer.

At the recent Google IO conference, Google announced their new product for Android development: Android Studio.

Android Studio is meant to replace the Eclipse plugin for Android development. There has been a lot of excitement surrounding the tool--apparently many people are not huge fans of Eclipse. Personally, I am a fan of Eclipse, but certainly think that Android has gotten big enough to merit its own tool for development.

Version 0.1

It is important to remember that this is not a fully polished product, so there will be plenty of bugs and quirks. Google is simply releasing an early preview and labeling it version 0.1

Thursday, May 2, 2013

Android Tic Tac Toe Part 3

This is the third and final part of the tutorial series on creating a Tic-Tac-Toe application. See part one about the interfaces and part two about implementing the game logic.

1. Creating a Custom View for the Tiles

In a previous tutorial I described how you could create a custom view in Android that will take attributes and implement custom logic. This is the approach we will take for creating the full Tic Tac Toe application.

Saturday, March 30, 2013

Android Relative Layouts

This post briefly describes how to use Android Relative Layouts.

1. Why Use Relative Layouts?

One of the challenges when it comes to designing Android apps is making your app look presentable on a multitude of different Android devices with different screen sizes and resolutions. Relative layouts can help to place views in the proper locations without specifying an absolute position.

Thursday, March 21, 2013

Android Tic Tac Toe Game Logic - Part 2

In this section of the Tic Tac Toe tutorial we will implement several of the classes that we created in part one of the tutorial.

Implementing the GameManager Interface

The GameManager is responsible for handling the overall state of the game, including determining whether or not a move is valid and if the player or AI opponent has won the game. The implementation of the interface is posted below.

Tuesday, March 19, 2013

Android AsyncTasks (MultiThreading)

This tutorial explains what AsyncTasks are in Android, why you should use them, and demonstrates a simple app that calculates prime numbers to show them in action.

1. What is an AsyncTask and Why Should I use Them?

AsyncTasks are asynchronous because they operate in a thread separate from the UI thread.

You should use them to complete performance intensive tasks or tasks that may complete in an indefinite amount of time. If you do not, the user interface will be blocked until the task is finished.

For example: if you trying to download a huge web page, if you task is run in the UI thread you will prevent the application from respond to other actions--such as pressing other buttons, zooming, pressing the back button--and your app will be frozen.

No one likes it when an app completely freezes, even if it is doing legitimate loading/calculating work. Additionally, if your app blocks the UI thread for more than 20 or so seconds, the Android Operating System will assume it is broken, and a force-close dialog will appear.