android 2.x Dialog with windowAnimationStyle cannot be dismissed -



android 2.x Dialog with windowAnimationStyle cannot be dismissed -

i find on android 2.3.3(emulator) , 2.3.4(huawei phone), dialog windowanimationstyle cannot dismissed. here code in activity:

private dialog mdialog; private view mdialogview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } handler mhandler = new handler() { @override public void handlemessage(message msg) { mdialog.dismiss(); super.handlemessage(msg); } }; public void clickbutton2(view view) { mdialog = new dialog(this, r.style.toalog); mdialogview = layoutinflater.from(this).inflate(r.layout.toast_view, null); mdialog.setcontentview(mdialogview); mdialog.settitle("title"); mdialog.show(); message msg = mhandler.obtainmessage(); mhandler.sendmessagedelayed(msg, 1000); }

and code in style.xml

<style name="toalog" parent="@android:style/theme.dialog"> <item name="android:windowanimationstyle">@style/shaloganimation</item> </style> <style name="shaloganimation"> <item name="android:windowenteranimation">@anim/fade_in</item> <item name="android:windowexitanimation">@anim/fade_out</item> </style>

code in /anim/fade_in.xml:

<?xml version="1.0" encoding="utf-8"?> <alpha xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:interpolator/decelerate_quad" android:fromalpha="0.0" android:toalpha="1.0" android:duration="@integer/enterfadeduration" />

/anim/fade_out.xml similar fade_in.xml

run code, can see dialog display on screen, , app won't respond click. if seek reinstall eclipse, emulator crash.

everything works fine on android 4.4.4(xiaomi phone) , 4.2.2(xolo phone)

is bug? or it's mistake?

the solution figure out not utilize windowanimationstyle on 2.x or lower. don't know happen on android 3.x

android

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -