So any ideas how I can call: getDecorView() without getting the error:
"AndroidRuntimeException: requestFeature() must be called before
adding content" ...?

On Jan 12, 8:39 pm, Tom Medhurst <[email protected]> wrote:
> I have an AlertDialog box instance I created from AlertDialog.Builder
> and I want to animate it with a anim/appear1.xml file I created
> earlier.
>
> Normally I would initialize the animation using
> AnimationUtils.loadAnimation, but I am having a problem applying this
> animation to the AlertDialog.
>
> To get the View of the dialog I call alertDialogInstance.getWindow
> ().getDecorView().setAnimation(...)
> However this throws an exception:
>
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):
> android.util.AndroidRuntimeException: requestFeature() must be called
> before adding content
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> com.android.internal.policy.impl.PhoneWindow.requestFeature
> (PhoneWindow.java:199)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> com.android.internal.app.AlertController.installContent
> (AlertController.java:166)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.AlertDialog.onCreate(AlertDialog.java:146)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.Dialog.dispatchOnCreate(Dialog.java:268)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.Dialog.show(Dialog.java:207)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> tommed.lastFMForAndroid.MusicPlayerActivity.startStreaming
> (MusicPlayerActivity.java:393)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> tommed.lastFMForAndroid.MusicPlayerActivity.setSongInfo
> (MusicPlayerActivity.java:317)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> tommed.lastFMForAndroid.MusicPlayerActivity.onCreate
> (MusicPlayerActivity.java:239)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
> 1122)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> 2103)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> 2156)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.ActivityThread.access$1800(ActivityThread.java:112)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.os.Handler.dispatchMessage(Handler.java:88)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.os.Looper.loop(Looper.java:123)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> android.app.ActivityThread.main(ActivityThread.java:3742)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> java.lang.reflect.Method.invokeNative(Native Method)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> java.lang.reflect.Method.invoke(Method.java:515)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
> (ZygoteInit.java:739)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
> 01-12 20:30:46.976: ERROR/mediaPlayer(555):     at
> dalvik.system.NativeStart.main(Native Method)
>
> I had a read of the documentation and I tried the following which
> didn't make any difference:
> Window dialogWindow = mBufferDialog.getWindow();
> dialogWindow.requestFeature
> (WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
> dialogWindow.requestFeature
> (WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);
> dialogWindow.getDecorView().setAnimation(AnimationUtils.loadAnimation
> (this, R.anim.expand_in));
>
> Anyone got any ideas what I am missing?
> Thanks
> Tom
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to