Async Task, friend of a responsive UI

So, it’s been a while. I have been trying to enhance my engine to do certain things like be responsive. I happen to know that you cannot do things that are resource intense with UI thread. Otherwise your program / game becomes unresponsive and that is not a good thing.

Async Task for the rescue!  This mechanism (classes) provided by Android API allows developer to do things in the background while not blocking the UI thread. In my word game I need to process database, possibly copy & read it at the very first time, find combinations of words and depending on the size of the database and length of the words, it might take few seconds. So, I decided to add a small splash screen for first time copy with AsyncTask. What it does, it copies the database from the APK to phone and shows a splash screen with a indicator.

Calling and using AsyncTask is very simple. Check the examples here. I got it up and running at the first try without problems. You can use it to process and load Images for access network resources and similar.

Here’s the splash screen. What you think? The picture is transparent so it looks a bit different on black background.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s