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.
Saturday, March 30, 2013
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.
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.
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.
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.
Subscribe to:
Posts (Atom)