Android Development

Rapid android development from Berlin

I just released my first application to the market.

The app is called RetroVillage and is a study project with some friends. Feel free to test the game, its still early beta so please be nice :)

If you find bugs, feel free to send me the logcat output to android[dot]retrovillage[at]gmail[dot]com.
If you wanna know how we have done something in the game, just ask and maybe I make a tutorial/post about it :)

Thank you!

[UPDATE]
We had to rename the application, which will take effect in the next update.
Anyway, we have now a new project page for the game.
I hope to see you there: http://www.saintfeintcity.org

  • Share/Bookmark

Sorry about the delay but I have finally managed to find the time to complete the Sound effect Tutorial which I hope you all enjoy.If you have not already check out the first tutorial here before reading this one, as it reuses a lot of the code.

In the previous tutorial we had a basic working sound system, but it was limited in scope. it could only be used in the class it was declared in and could not be used between activity’s easily. Ideally we would like one instance of the Sound Manager that could be used across the entire app life-cycle.

The solution is the Singleton design pattern explained better here.In essence, we will create only one instance of the Sound Manager class that can be accessed anywhere within the application.
continue reading…

  • Share/Bookmark

While my last design was a good decision at first (I like dark themes) the majority like light themes.
During some comments about the design, the readability and the usability, I decided to change the design.
I am a passable programmer, for Android and Web, but if I would create my own design, nobody would stay here to read articles. Thats the reason why I took, again, a free and non customized design for Wordpress. Its called Arjuna-X.

If you see something doesn’t work or is simply bad, just leave a comment and I will try to change it.

  • Share/Bookmark

The second part of this series will show you how you can scroll smoothly over the simple 2D Map which was created in the first part.

Note: I changed my coding style to fit the Java/Android coding style. Please be aware that variables like _mapSize are now mMapSize.

The performance issue we discovered in the first part was awful and no one will play a game which needs seconds to draw another frame. But why do we have this performance issue?
Do you remember how we draw the Map? We go trough the map in a loop and draw each cell. If our map has only a size of 10, everything is fine, but if we go to 100 and more, we draw a lot of cells and most of them are not on our display. And thats the mistake: We use resources and time to draw cells we don’t see.
continue reading…

  • Share/Bookmark

Android 2.1 SDK is out. The API level changed to 7 but its mainly a minor update.
New stuff: the animated background you already know from Nexus One and a new SignalStrength class which provides information about the device’s current network signal.

Anything else are mainly new methods on already existing classes.

The update is available as a download or as an update in your SDK Manager.

  • Share/Bookmark

This how to will show you how you can create a simple 2D Map with Cells to place stuff on it. Just like the old school SimCity.

The first thing you need is an Activity with a SurfaceView and a Thread to trigger the drawing. Who doesn’t know these fundamentals, please read my series on 2d graphics first.

Lets start with the smallest unit for our map: the Cell.
Each Cell will have a background color and a unique ID.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.droidnova.android.games;
 
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
 
/**
 * A part of the map.
 */
public class Cell {
    public int _id = 0;
    public int _backgroundColor = Color.GREEN;
 
    /**
     * Konstruktor.
     * @param id
     */
    public Cell(int id) {
        _id = id;
    }
 
    /**
     * Draw the cell
     *  
     * @param canvas Canvas to draw on.
     * @param paint Color of the "pencil".
     * @param x X coordinate.
     * @param y Y coordinate.
     */
    public void draw(Canvas canvas, Paint paint, int x, int y) {
        paint.setColor(_backgroundColor);
        canvas.drawRect(x, y, x + CellMap._cellSize, y + CellMap._cellSize, paint);
 
        paint.setColor(Color.BLACK);
        canvas.drawText("" + _id, x + 1, y + 10, paint);
    }
}

On line 32 you see, how we draw the cell. The variable _cellSize is a static variable from CellMap, which will be introduced later. Everything else should be already known.
continue reading…

  • Share/Bookmark

While working on an application which should look similar to an iPhone application, I have to create a bar at the top where I have a back and a forward button (each on one side) and a dynamic text centered in the middle between them.
To get this done, I searched quite a lot and got it finally to work.
The surrounding layout should be the RelativeLayout with two Buttons (in my case I used ImageViews) and a TextView.
continue reading…

  • Share/Bookmark

Sometimes I am a bit over motivated. Thats the reason I upgraded my Ubuntu to 9.10 RC1 yesterday.
Nearly everything worked fine and after 90 minutes downloading and installing Ubuntu 9.10 booted the first time.
The disillusion followed today: What happened with my Eclipse installation?
The LogCat view has no logging type buttons, the Devices view has lost its button for stopping processes and some windows don’t accept a mouse click on their buttons (mostly the OK button). I have to press Enter to get them work.

After a short search I found this bug report for ubuntu: https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/442078

A workaround is also mentioned there:

Create a launch script for eclipse with the following code:

#!/bin/sh
GDK_NATIVE_WINDOWS=1 /path/to/eclipse

I am not sure if Ubuntu is responsible or Eclipse, but after using this launch script, everything worked fine.

  • Share/Bookmark

In today’s tutorial I am going to show you my method of creating, managing and using sound effects in Android. In this first part I’ll show you the basic method of encapsulating your sound management code. This method works best when you have a typical application, or simple game all in one thread. After you have read this check out Part 2 which will show you a more advanced way to manage your sound across multiple classes.

The method I use to play sounds is to use the Sound Pool classes rather then the Media Player classes that the Android dev-guide seems to suggest. While there is nothing wrong with using the Media Player classes for simple applications they did not provide the flexibility I needed.
continue reading…

  • Share/Bookmark

Many Applications, mostly games, on the market show splash screens. With this screen they prompt a logo for the application and/or the author.
I will show you a short way to implement a splash screen which will occur on every startup, will stay for a number of seconds you can define, will close on touching the screen and will not reappear on pressing the back button.

I created an empty project named SplashScreen with the activity SplashScreen. This activity will display the splash screen, so we have to create a new activity which will be the first real view you want to display. In my case this activity is named MyApp.
continue reading…

  • Share/Bookmark
Powered by WordPress Web Design by SRS Solutions © 2010 Android Development Design by SRS Solutions