Nightonke / BoomMenu

A menu which can ... BOOM! - Android
5.81k stars 1.16k forks source link

On new version 2.0.9 builder fail #115

Closed Traumhaftt closed 7 years ago

Traumhaftt commented 7 years ago

When I start the activity, builder fail, so unable to start activity. I used the new version of boom button menu and I changed the background color, text and image of click buttons differently.

        builder.normalText(tagList.get(i));
        builder.normalImageRes(iconMap.get(.tagList.get(i)));
        builder.normalColorRes(colorMap.get(tagList.get(i)));
        bmb.addBuilder(builder);

How can I solve it?

Nightonke commented 7 years ago

Hey, could you provide the error message?

Traumhaftt commented 7 years ago

E/FirebaseCrash: Error sending crash report bma: Server did not receive report: Origin Error message: Invalid crash time, too new: seconds: 1493075992 nanos: 63000000. at bmk.a(:com.google.android.gms.DynamiteModulesC:1053) at bmq.a(:com.google.android.gms.DynamiteModulesC:5055) at bmq.run(:com.google.android.gms.DynamiteModulesC:54) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761)

FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start activity ComponentInfo{MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference at com.activities.MainActivity.boomButtonMenu(MainActivity.java:1024) at com.activities.MainActivity.onCreate(MainActivity.java:226) at android.app.Activity.performCreate(Activity.java:6662) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)

Nightonke commented 7 years ago

It seems that the error does not happen in BMB. Are you sure the iconMap and colorMap contains the Integer value that you need?

Traumhaftt commented 7 years ago

Yeah. Before listener, I fill in the maps with integer values. Actually, it was working but after some time, it doesn't start to work.

Nightonke commented 7 years ago

I suggest you to add a conditional judge for the error:

Integer imageRes = iconMap.get(.tagList.get(i));
if (imageRes == null) {
    Log.d(...);
} else {
    builder.normalImageRes(imageRes);
}