0

i try to create my custom progressdialog.i created xml layout file and i try to use this file to progressdialog.also i wrote GifView and i try to show my gifview in progressdialog. this is a my code

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="110dp"
android:layout_gravity="center"
android:background="@drawable/progressdialog"
android:orientation="vertical" >

<com.example.androidgif.GifView
    android:id="@+id/gifview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true" />

<TextView
    android:id="@+id/loadertext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/gifview"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="14dp"
    android:gravity="center_vertical"
    android:text="loading"
    android:textColor="#ffffff"
    android:textStyle="bold" />

and mainactivity.java code

public class MainActivity extends Activity {


GifView gifView;
ProgressDialog progressDialog = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    progressDialog = new ProgressDialog(this);
    progressDialog.setContentView(R.layout.custom_progressdialog);
    gifView = (GifView)progressDialog.findViewById(R.id.gifview);
    progressDialog.setCancelable(true);
    progressDialog.show();        




}

}

i have like this logcat error

requestFeature() must be called before adding content

how i can solve my problem if anyone knows solution please help me

BekaKK
  • 2,033
  • 5
  • 38
  • 74
  • Please, provide complete logcat, it usually shows which exact feature should be requested. – sandrstar Sep 04 '14 at 07:59
  • 1
    You have to call `progressDialog.show()` before `progressDialog.setContentView()`. See http://stackoverflow.com/a/10070995 – dng Nov 20 '14 at 14:48

0 Answers0