Android Development

Well, I’ve begun learning to develop Android applications.

I followed Hack a Day’s Android Development 101 tutorial which explained how to set up Eclipse for Android Development and writing a ‘Hello World’ application.


I always find with learning a new language that the biggest hurdle is setting up your development environment and getting to grips with a new IDE or build process.

I have tried to begin using Eclipse a number of times before but always give up and fall back to Notepad++ because bloated IDEs annoy me. This is usually fine for scripting languages that don’t required tons of bumph to build a project (manifest.xml etc.) but I’ve always found that Java is easier using an IDE because building and running becomes a one click step. We used to use Netbeans at Uni but I always hated it for being slow and clunky, so far Eclipse seems pretty good.

So my first real Android project is going to be to port a VOIP server/client from Java on windows. It should be interesting to see just how easy it is to port and how cross platform Java really is.

So far, I’ve had some problems with Threads implementing Runnable and being started in this way:

thread = new Thread(this); thread.start();

Which caused some errors regarding Handlers:

Can't create handler inside thread that has not called Looper.prepare()

Stackoverflow provided a few people with the same error, but in the end I removed the Threat.start() code from inside my Runnable class and created Handlers in the main activity class instead. Now my threads are started in the following way:

VoicePlayerThread player = new VoicePlayerThread();
Handler PHandler = new handler();
PHandler.post(player);

I believe that handlers are a way for the program to add things to an event queue of sorts and the post() function takes an instance of a Runnable class which is to be started.

Now I seem to be getting:

Unsupported configuration: sampleRate 44100, format 1, channelCount 1

In my audio recording thread. I’m using android.media.AudioRecord to capture byte packets from the microphone and my AudioRecord object is defined as so:

int rate = 44100;
int channels = AudioFormat.CHANNEL_IN_MONO;
int enc = AudioFormat.ENCODING_PCM_16BIT;
int buffSize = AudioRecord.getMinBufferSize(rate,channels, enc);
recorder = new AudioRecord(
    MediaRecorder.AudioSource.MIC,
    rate,channels,enc,buffSize);

I believe that this is correct according to the Docs for AudioRecord but obviously there’s something wrong. We shall see… **update**

One thought on “Android Development

  1. Pingback: Unsupported configuration: sampleRate 44100, format 1, channelCount 1 | A Software Developer's Blog

Leave a Reply

Your email address will not be published. Required fields are marked *