Android Development

Rapid android development from Berlin

Browsing Posts tagged android

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

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

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

As requested here is a sample tutorial in how to create a menu system for games in Android. Sorry for the delay but this tutorials take time to code test and write up. Anyway I hope you find it useful.

Before I jump into the code I’m going to take a second to explain my way of coding menus in Android. As we all know Android is built on the concept of activities. If you have been following earlier tutorials you already know how to create activities which can display graphics and deal with player input. But what if you want several different screens, such as options or credits? You could code them all into one activity but you would end up with a bloated and hard to maintain class.
continue reading…

  • Share/Bookmark

Every new Android SDK Version means that someone has to collect the sources and bundle them. Thanks to the supporter of the missing source jar issue a new source jar is provided. Also please star the issue to flag that issue as important!

Install instructions:

To use it in Eclipse, create a directory sources/ inside your
/platforms/android-1.6/ directory, and unzip the archive there. Start
Eclipse and check that you can see the source, for example ask for the definition of
the Gesture class (new in 1.6), you should see the source code, not the decompiled
byte code.

We will mirror the sources to, so feel free to download and use it!
Android SDK 1.6 sources

  • Share/Bookmark

If you read my last tutorial entry here, then you may have come across a problem with the code.

If you load several large bitmaps using the BitmapFactory class to decode the bitmap you application will give you the dreaded force close dialogue box. A quick look in the logcat shows that a bitmap exceeds the virtual machine memory budget.

1
ERROR/AndroidRuntime(750): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

You may wonder how its possible that a few PNG’s can take up all the 16 mb of memory allocation for an application.
continue reading…

  • Share/Bookmark

In order to make anything more than very simple games in 2D it’s important to be able to draw animated sprites.

There are several ways to create animated sprites in Android, including using XML based declarations and swapping between multiple bitmaps. But when I came to write my animation code neither of these methods was flexible enough for the kind of animation I needed.

Instead of using these methods I instead used sprite sheets and the functionality provided by the Android bitmap drawing functions to draw each frame of the animation. In a nutshell each frame of animation is set on a single bitmap one after the other. The animation code then plays one frame after the other until the animation is complete. Below is an example of a sprite of a bouncing color changing arrow.
continue reading…

  • Share/Bookmark

Updated to be Android 2.0.1 compatible.

You are new to this series? Please start with the first part.

The sixth part of this series will show you how you create the correct perspective because 3D is nothing without the correct perspective.

Before we start we should discuss the two possible “views” OpenGL offers: orthographic and perspective.
continue reading…

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