ProgressDialogPro exception
Hi,
I'm using this great library in my application. I'm getting the following crash report on a Lenovo A916 with Android 4.4, when showing a indeterminate ProgressDialogPro:
android.content.res.Resources$NotFoundException: Resource ID #0x0 at android.content.res.Resources.getValue(Resources.java:1133) at android.content.res.Resources.loadXmlResourceParser(Resources.java:2381) at android.content.res.Resources.getLayout(Resources.java:949) at android.view.LayoutInflater.inflate(LayoutInflater.java:395) at android.view.LayoutInflater.inflate(LayoutInflater.java:353) at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:305) at com.alertdialogpro.internal.AlertController.installContent(Unknown Source) at com.alertdialogpro.AlertDialogPro.onCreate(Unknown Source) at com.alertdialogpro.ProgressDialogPro.onCreate(Unknown Source) at android.app.Dialog.dispatchOnCreate(Dialog.java:361) at android.app.Dialog.show(Dialog.java:262) at it.cammino.risuscito.PaginaRenderActivity.cmdPrepare(Unknown Source) at it.cammino.risuscito.PaginaRenderActivity.access$900(Unknown Source) at it.cammino.risuscito.PaginaRenderActivity$7.onClick(Unknown Source) at android.view.View.performClick(View.java:4463) at android.view.View$PerformClick.run(View.java:18772) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5292) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641) at dalvik.system.NativeStart.main(Native Method)
My code is just:
mp3Dialog = new ProgressDialogPro(PaginaRenderActivity.this);
mp3Dialog.setMessage(getResources().getString(R.string.wait));
mp3Dialog.setOnDismissListener(new OnDismissListener() {
@Override
public void onDismiss(DialogInterface arg0) {
setRequestedOrientation(prevOrientation);
}
});
mp3Dialog.show();
I set correctly the theme in my settings:
<style name="Theme.MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
..
<item name="alertDialogProTheme">@style/AppTheme.FlavoredMaterialLight</item>
</style>
<style name="AppTheme.FlavoredMaterialLight" parent="Theme.AlertDialogPro.Material.Light">
<item name="colorAccent">@color/theme_accent</item>
</style>
It seems that the error occurs only on this particual device, as I tested my application on many Kitkat devices and this crash never occurred.
Any help?
Thanks in advance. Marcello
That's weird. The layout's resource ID of the ProgressDialogPro is #0x0. Be honest, I don't know the actual reason only if I can get that Lenovo A916 with Android 4.4.
Which theme did your PaginaRenderActivity use?
It uses the following theme on kitkat:
<style name="AppTheme" parent="Theme.MyTheme" >
<item name="toolbar_shadow">@drawable/toolbar_shadow</item>
</style>
The parent is the one which I mentioned above.
Hi. I want to know whether ProgressDialogPro has obtained the right layout id. Please add below code to your PaginaRenderActivity's onCreate method. And log the value of layoutId. Tell me the result. It should not be 0x0.
TypedValue outValue = new TypedValue();
getTheme().resolveAttribute(com.alertdialogpro.R.attr.alertDialogProTheme,
outValue,
true);
int layoutId = new ContextThemeWrapper(this, outValue.resourceId).getTheme().obtainStyledAttributes(null,
com.alertdialogpro.R.styleable.AlertDialogPro,
com.alertdialogpro.R.attr.alertDialogProStyle, 0).getResourceId(
com.alertdialogpro.R.styleable.AlertDialogPro_adpProgressLayout, 0);
It is not 0x0
03-25 12:50:18.672 11364-11364/it.cammino.risuscito I/class it.cammino.risuscito.PaginaRenderActivity﹕ layoutId: 2130968618
Ran with that Lenovo A916?
Unfortunately not :( I don't own that phone. I got the error from an user through the play store.
: (
Any idea? I have no idea on how to replicate the issue...
How many users have been affected by this issue? If the error occurs only on that Lenovo A916 now. I recommend you to hold it until you get more reports.
That's the only one user, and the current version of the application has been in production for one month.
I solved the problem using a normal AlertDialogPro and inflating, as custom view, the same layout took from the ProgressDialogPro. I emailed the user and he answered that now it works fine.