0

I need to make a simple progress dialog with a square with only a circle inside enter image description here

like this but on an dark back ground. 50x50 dp.

I tried this. But my app is crashes on the show() Display progressdialog without text Android

here is my code : utils.java

protected void startLoading() {
        ProgressDialog proDialog = new ProgressDialog(this.getActivity()); 
        proDialog.setCancelable(false);
        proDialog.setContentView(R.layout.progressdialog);
        proDialog.show();
    }

.xml

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:background="@android:color/transparent" >

    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

</RelativeLayout>

what am i doing wrong?

Community
  • 1
  • 1
igor
  • 716
  • 1
  • 9
  • 27

2 Answers2

0

og : 10-18 12:28:26.924: E/AndroidRuntime(809): android.util.AndroidRuntimeException: requestFeature() must be called before adding content

This is not because of your progressBar.

You probably are calling a requestFeature method (for hiding your windowBar, for making your app fulscreen or something else) after your setContentLayout in your onCreate method. Please, put this call before your setContentLayout and this would work ;)

Juan Aguilar Guisado
  • 1,687
  • 1
  • 12
  • 21
  • i don't have a requestFeature(). also if i remove "proDialog.setContentView(R.layout.progressdialog);" the progress dialog appear but not look as i want it to be. – igor Oct 19 '14 at 10:58
0

Found the answer :

need to switch between

proDialog.show();

and then to set Content.

proDialog.setContentView(R.layout.progressdialog);

igor
  • 716
  • 1
  • 9
  • 27