AlertDialogPro icon indicating copy to clipboard operation
AlertDialogPro copied to clipboard

ProgressDialogPro exception

Open marbat87 opened this issue 11 years ago • 12 comments

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

marbat87 avatar Mar 25 '15 08:03 marbat87

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.

fengdai avatar Mar 25 '15 09:03 fengdai

Which theme did your PaginaRenderActivity use?

fengdai avatar Mar 25 '15 09:03 fengdai

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.

marbat87 avatar Mar 25 '15 09:03 marbat87

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);

fengdai avatar Mar 25 '15 11:03 fengdai

It is not 0x0

03-25 12:50:18.672  11364-11364/it.cammino.risuscito I/class it.cammino.risuscito.PaginaRenderActivity﹕ layoutId: 2130968618 

marbat87 avatar Mar 25 '15 11:03 marbat87

Ran with that Lenovo A916?

fengdai avatar Mar 25 '15 14:03 fengdai

Unfortunately not :( I don't own that phone. I got the error from an user through the play store.

marbat87 avatar Mar 26 '15 07:03 marbat87

: (

fengdai avatar Mar 26 '15 08:03 fengdai

Any idea? I have no idea on how to replicate the issue...

marbat87 avatar Mar 26 '15 09:03 marbat87

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.

fengdai avatar Mar 26 '15 11:03 fengdai

That's the only one user, and the current version of the application has been in production for one month.

marbat87 avatar Mar 26 '15 12:03 marbat87

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.

marbat87 avatar Mar 30 '15 09:03 marbat87