The code snippet displays the Progress Bar in the Mobile Screen
// Additional Text Views are added to display the progress bar in the middle of the screen
progressbar.xml
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center" android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="" />
<ProgressBar android:id="@android:id/progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:soundEffectsEnabled="true" />
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="" />
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Launching Application.... " />
</LinearLayout>
// Function to be written inside a Class extending Activity
protected void onCreate(Bundle b) {
super.onCreate(b);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
// Layout for Progress Bar to be defined in progressbar.xml
setContentView(R.layout.progressbar);
getWindow().setFeatureInt(Window.FEATURE_INDETERMINATE_PROGRESS,
Window.PROGRESS_VISIBILITY_ON);
}