Archive

Archive for the ‘Android Development’ Category

Opengl ES – Texture Atlas


In order to improve my app’s OpenGL rendering performance,
I’ve decide to replace my texturing code.

My app is using 8 256X256 textures, each one of them is binded and drawn to a square like shape.
This means I was making 8 BindTexture calls. This has a large impact on performance and here comes the usage of a term called Texture Atlas.

Texture Atlas is a one big texture that holds up all of the app textures instead of using several textures.

This means I can minimize the BindTexture into a one call, thus improving performance.

Each time I supply different texture coordinates for the specific texture I need to use.

I still have more optimizations to perform, like figuring out how to speed up my dynamic camera preview texture.

But the texture atlas is a good start, and show satisfying results.

Categories: Android Development

My app doesn’t work on EVO :(


I’ve received many 1 stared comments at the Android Market from users with HTC EVO.
I have no idea why it didn’t work for them, I couldn’t see any crash logs at the Market developer panel, so I’m clueless about the crash reason.
Unlike iPhone development, Android development is much more harder since I have to test it on many devices. I don’t have an Evo, nor can I buy one. I will appreciate if some of the EVO users can provide me with logs or detailed information about the crashes.
There is know way I can simulate the error, and I wan’t to support if not all, at least the major devices.

The only difference between the desire and EVO is the screen number of colors and the camera, so it’s probably something there.

Android Handler object


A useful object to know, is Android’s Handler object.
Why should we use it? or more correctly when should we use it?
Well, in many programming language, maybe even all of them, we can’t update a UI component from a different thread.
UI components can only be updated from within the main UI thread, and Android is no exception.

Using the Handler object is very simple:

1. Create the handler object at the main thread (UI Thread).
2. Pass it to the secondary thread.
3. Secondary thread can now use the Handler’s post method and supply a Runnable for it, enabling to do what ever UI updating you want to do.

Simple as that, but vary important tool to use!

Categories: Android Development

Putting my application on Android market


Although my application is far from complete, I’ve decided to put it on the market and see what people think about it.

Most of them have problems running it, mostly crushes.

It made me realize that I need my code to be more robust and support various hardware configurations.

More than 200 people downloaded my app in a few days, which is good start.

Categories: Android Development

decodeYUV420SP using JNI = Nice performance boost

June 26, 2010 5 comments

One of the major issues when trying to implement custom camera live preview,
is converting the byte[] data from the public void onPreviewFrame(byte[] data, Camera camera) function,
to RGB.

This has a huge impact on my app frame rate.

After implementing it using JNI and the NDK, I’ve noticed a huge performance difference.
I didn’t measure it though, so I can give the exact numbers.

I’ve still have some performance issues, that need to be taken care of.

In this stage the app doesn’t have the smooth performance I wan’t…

Categories: Android Development

findViewById return null !!


Trying to cast my view always returned null:

m_View = (MyCustomView)findViewById(R.id.View1);

After A googling a bit I’ve found my problem:

MyCustomViewconstructor didn’t contain “AttributeSet attrs”.

Modifying it fixed the problem.

So two important things to remember:

1. Must call setContentView before findViewById
2. Custom view constructor must receive the following parameters: Context context, AttributeSet attrs

Good luck! 🙂

Categories: Android Development

OpenGL ES Hell :/


I have a weird bug in my application when using OpenGL textures,
from some reason I have a texture that renders white while all other texture are fine.
I can’t find the reason for this, as it delays my development a lot.

Probably something with wrong OpenGL state, but I can’t pinpoint this problem.

Very frustrating, I’m hopping to overcome this obstacle.

Categories: Android Development