Categories
Android

Displaying notifications and progress bar from an instance of AsyncTask

The AsyncTask class is used to perform background tasks and it might be useful to show notifications and progress bars to alert the user.
In this post I write an example where I create two AsyncTask instances showing a startup notification, a progress bar and a notification of completed task

Categories
Android

Updating frequently a TextView inside a loop

The problem
How to update a TextView inside a loop or, more generally, how to update frequently an UI element of an Activity.

Categories
Android

The android.os.NetworkOnMainThreadException exception

In this article I explain a possible cause of android.os.NetworkOnMainThreadException and how to avoid it.
From the Android site you can read:
NetworkOnMainThreadException
The exception that is thrown when an application attempts to perform a networking operation on its main thread.
This is only thrown for applications targeting the Honeycomb SDK or higher…