Wednesday, June 22, 2011

Computer Trouble

Unfortunately it looks like my computer where I do all my Android development has died. It was a Gateway desktop. I haven't had time to see if it is anything I can fix yet.

I have a laptop that I use as well, but I will need to set it up for proper Android development. It may be a little while longer before I get any big tutorials up.

But I am still planning on keeping up the pace of publishing more tutorials to the blog, once I get going again. Feel free to make any requests in the comments and I will try to get to them.

Monday, June 20, 2011

Hi everybody!
We have good news for you.


You can now contact us

via email: theandroiddom@gmail.com

via Twitter: @AndroidDom

Talk to us, we would love to hear from you.


We are also working hard to bring you an improved Android Dom experience.
So, pardon the dust while we make some changes around here.


Friday, June 17, 2011

Displaying an Android Toast

This tutorial describes how to display a toast in an Android Application.

What is a Toast?

A toast is a small message that pops up at the bottom of the user's Android device. Shown below is a screenshot of a toast. Toasts differ from message boxes in the fact that they don't take focus, so they are less intrusive.

Screenshot of an app displaying a toast.

Wednesday, June 15, 2011

Android Shopping Cart Tutorial Part 2

This tutorial picks up where the first Android Shopping Cart Tutorial leaves off. In this part we will modify the shopping cart to be able to handle multiple quantities of products.

The source code is now available on github.
Update - after following this tutorial, be sure to check out part 3.

Before We Begin...

Code often goes through many iterations. And we will do that with the existing shopping cart code from the first Android Shopping Cart Tutorial. In this tutorial we will update the code to handle quantities of products. We will also update the code to be even more object oriented which should make it easier to add more features in the future.

Screenshot of the ShoppingCartActivity displaying quantities

Tuesday, June 14, 2011

Displaying an Android Pop Up Dialog (AlertDialog) Part Two

In this tutorial we revisit Android Alert Dialogs use as pop up windows and dive into some more advanced features. These include setting positive,negative, and neutral buttons, adding a text view, and setting a completely custom layout.

Intro

In this tutorial we will demonstrate some more advanced features of the Pop Up dialog. These advanced features can be useful, but it is important to reiterate a word of caution. Pop up windows can be annoying.

It can be tempting to throw in a couple of settings in a pop up window, which can be fine, but plan ahead if you want to add more settings in the future. Pop up windows are smaller than a full activity, and can be difficult to deal with if they are presenting too much information.

We are going to build off the code that we created in the first part of the tutorial, Displaying an Android Pop Up Dialog (AlertDialog).

Screenshot showing the positive, negative, and neutral buttons.

Saturday, June 11, 2011

Displaying an Android Pop Up Dialog (AlertDialog)

This article will demonstrate how to display a pop up dialog (AlertDialog) in Android. Be sure to check out part 2 when you are done.

Why Use a Pop Up Dialog

Sometimes you want to be able to quickly display a small amount of information to the user. Pop up dialogs are perfect for doing this. The user can see and interact with a small message, without being driven too far away from the main activity.

However, make sure you don't go overboard with your use of pop up dialogs. If you are trying to display a lot of information they can be ugly looking, and users could become annoyed if too many of them start showing up.

Screenshot of the app showing a pop up dialog

Wednesday, June 8, 2011

Adding Local Images to An Android Webview

This tutorial demonstrates how to download a web page from the internet, and then modify that web page to use local graphics resources before displaying to the user.

Why Use Local Images?

Perhaps you want your app to dynamically load data from the internet, but you frequently want to display the same images. Using local images can be a good way to cut down on the amount of bandwidth needed for an application and could improve performance.

Before We Start

If you haven't all ready, please take a look at the previous tutorial, displaying a static web page in android.This tutorial will be building off of that.

Sunday, June 5, 2011

Android and SQLite

This tutorial demonstrates how you can use SQLite in your Android application to build a list of high scores.

Why Use SQLite in your Android App?

SQLite can be a powerful tool that makes it easy to store, access, and manipulate data.

Say that you have designed a game for Android, and you would like to keep track of the user's high scores for the game. You could store the high scores in an SQLite database, and retrieve the scores sorted from highest to lowest to display to the user.

I should also note that some basic understanding of SQL would be helpful when reading this tutorial.

Building a Simple App

We are going to build a simple app that will allow us to test using SQLite to store and retrieve our list of high scores. Our app must allow us to easily add new scores and easily retrieve the list of high scores.


The Layout

Our app will include an text input and a corresponding button to add a new high score, and a webview to display the highscores. The webview will refresh whenever a new highscore has been added.

Screenshot of the layout



The first text input will contain the name of the player for the high score. The second text input will contain the score.

Android Tic Tac Toe Game Logic - Part 1 Interfaces

This post describes the game logic behind making an Android version of Tic Tac Toe and the interfaces used to accomplish this. The goal is to separate the game logic as much as possible from the display logic.

Representing the Game Board

In this tutorial, we are going to think of the game board as being made up of nine separate tiles. Each tile will draw a different border depending on the location of the tile. A tile will also be drawn different based on what its state is set as.

Valid states are:
  • Empty
  • X
  • O
These states will be defined in a separate class that we create to hold Constants relating to the game.

Friday, June 3, 2011

Properly Scaling Android Images

This article describes how you can get an image to properly scale in an Android Image View.

Designing apps on the Android platform can sometimes be a challenge. Sometimes when dealing with images, you create a source image that is too large to fit on every screen. Since your app will likely run on a multitude of different devices, you want to ensure that it looks as good as possible on several different sized screens.

The Background Property

An image can automatically be scaled by setting it as the background property for a view. Sometimes this is desirable. For example, if you have an image that you want to be used as a background for your entire app, that is well suited to being stretched and skewed.

A linear layout with the background property set as an image