You must either set the view to be the contentview of your activity, or add it to the view heiarchy using ViewGroup.addView to append you progressbar to the root view
public void ViewGroup.addView (View child)
Added in API level 1
Adds a child view. If no layout parameters are already set on the child, the default parameters for this ViewGroup are set on the child.
Note: do not invoke this method from draw(android.graphics.Canvas), onDraw(android.graphics.Canvas), dispatchDraw(android.graphics.Canvas) or any related method.
Parameters
child the child view to add
public void Activity.setContentView (View view)
- Added in API level 1
Set the activity content to an explicit view. This view is placed directly into the activity's view hierarchy. It can itself be a complex view hierarchy. When calling this method, the layout parameters of the specified view are ignored. Both the width and the height of the view are set by default to MATCH_PARENT. To use your own layout parameters, invoke setContentView(android.view.View, android.view.ViewGroup.LayoutParams) instead.
Parameters
view The desired content to display.