I've included a custom AlertDialog in my app. After updating my Galaxy Nexus to Jelly Bean the dialog is not displayed anymore. Only the screen is darkened. The processes around the dialog (like loading data) are working perfectly. On older OS versions the code worked (including ICS 4.0.4).
The problem appears no matter the dialog is created and shown in an AsyncTask or outside.
Has anybody similar problems?
Here is the code:
public class TLProgressDialog extends AlertDialog{
/*Log tag */
@SuppressWarnings("unused")
private static final String TAG = "TLProgressDialog";
@SuppressWarnings("unused")
private Context context;
private AnimationDrawable animation;
protected TLProgressDialog(Context context) {
super(context);
this.context = context;
}
public TLProgressDialog(Context context, boolean cancelable,
OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
this.context = context;
}
public TLProgressDialog(Context context, int theme) {
super(context, theme);
this.context = context;
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tlprogressdialog);
ImageView img = (ImageView)findViewById(R.id.dialog_img);
img.setBackgroundResource(R.drawable.tlprogress_animation);
animation = (AnimationDrawable) img.getBackground();
img.post(new Starter());
}
public static TLProgressDialog show(Context context){
TLProgressDialog dlg = new TLProgressDialog(context);
dlg.setCanceledOnTouchOutside(false);
dlg.setCancelable(false);
dlg.show();
return dlg;
}
private class Starter implements Runnable {
public void run() {
animation.start();
}
}
}
The xml layout is just a single ImageView which hostes an animated image:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/dialog_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</RelativeLayout>
My fault, just found out that I've included GIF's for the animation. This seems not working anymore. After converting to PNG's it works again.