Dialog on the mainActivity
xamo1998 opened this issue · 1 comments
Somehow when I instanciate a Dialog in the main activity like this:
Dialog dialog= new Dialog(getApplicationContext());
it throws me this error:
06-21 22:17:34.580 23956-23956/com.animusapp.rubiktimer E/AndroidRuntime: FATAL EXCEPTION: main Process: com.animusapp.rubiktimer, PID: 23956 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.animusapp.rubiktimer/com.animusapp.rubiktimer.MainActivity}: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f04007c a=4} at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f04007c a=4} at android.content.res.TypedArray.getColorStateList(TypedArray.java:538) at com.rey.material.app.Dialog.applyStyle(Dialog.java:252) at com.rey.material.app.Dialog.init(Dialog.java:177) at com.rey.material.app.Dialog.<init>(Dialog.java:121) at com.rey.material.app.Dialog.<init>(Dialog.java:104) at com.animusapp.rubiktimer.MainActivity.onCreate(MainActivity.java:95) at android.app.Activity.performCreate(Activity.java:7174) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) 06-21 22:17:34.581 23956-23956/com.animusapp.rubiktimer E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.animusapp.rubiktimer/com.animusapp.rubiktimer.MainActivity}: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f04007c a=4} at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2957) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374) Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 5: TypedValue{t=0x2/d=0x7f04007c a=4} at android.content.res.TypedArray.getColorStateList(TypedArray.java:538) at com.rey.material.app.Dialog.applyStyle(Dialog.java:252) at com.rey.material.app.Dialog.init(Dialog.java:177) at com.rey.material.app.Dialog.<init>(Dialog.java:121) at com.rey.material.app.Dialog.<init>(Dialog.java:104) at com.animusapp.rubiktimer.MainActivity.onCreate(MainActivity.java:95) at android.app.Activity.performCreate(Activity.java:7174) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032) at android.app.ActivityThread.-wrap11(Unknown Source:0) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696) at android.os.Handler.dispatchMessage(Handler.java:105) at android.os.Looper.loop(Looper.java:164) at android.app.ActivityThread.main(ActivityThread.java:6944) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
I would appreciate the help Thanks!
Well I solved it just changing getApplicationContext()
to this