ProgressBar updating using Message Handler

SDK Version: 

You're going to learn how to make a progressbar, which gives you a feedback what's going on in the background.

Let say you have a LoadingScreen activity (loadingscreen.xml layout), and a Main activity (main.xml).

You'd like to do some job in the Main activity, and update the progressbar status at the same time. To do this, we are going to use Messages. Although, you can update you're progressbar by sending the progressbar instance itself to your Main activity, but that's obviously not the prettiest solution.

What we going to do is:

1. Declaring a progressbar instance in LoadingScreen Activity:

So in your, after Oncreate(), you should add something like this line to your codeline: (don't forget to add a progressbar to your layout first!)

  1.   ProgressBar pb = (ProgressBar)findViewById(;

2. Setting up a Handler to handle Messages from outside:

Custom View - HorizontalSlider

SDK Version: 

In this tutorial we'll create a custom View called HorizontalSlider based on ProgressBar. This slider will allow the user to move the slider back and forth on the screen and get notified when this happens.

Syndicate content