Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error... #3

Closed
pranavlathigara opened this issue Nov 12, 2016 · 12 comments
Closed

getting error... #3

pranavlathigara opened this issue Nov 12, 2016 · 12 comments

Comments

@pranavlathigara
Copy link

android.view.InflateException: Binary XML file line #27: Error inflating class android.widget.RelativeLayout at android.view.LayoutInflater.createView(LayoutInflater.java:627) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:676) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:701) at android.view.LayoutInflater.rInflate(LayoutInflater.java:762) at android.view.LayoutInflater.inflate(LayoutInflater.java:499) at android.view.LayoutInflater.inflate(LayoutInflater.java:398) at android.view.LayoutInflater.inflate(LayoutInflater.java:354) at com.kunzisoft.switchdatetime.SwitchDateTimeDialogFragment.onCreateDialog(SwitchDateTimeDialogFragment.java:106) at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:312) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1113) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295) at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801) at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1682) at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:541) at android.os.Handler.handleCallback(Handler.java:733) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5590) 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:1268) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.constructNative(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at android.view.LayoutInflater.createView(LayoutInflater.java:601) at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:676)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:701)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:762)  at android.view.LayoutInflater.inflate(LayoutInflater.java:499)  at android.view.LayoutInflater.inflate(LayoutInflater.java:398)  at android.view.LayoutInflater.inflate(LayoutInflater.java:354)  at com.kunzisoft.switchdatetime.SwitchDateTimeDialogFragment.onCreateDialog(SwitchDateTimeDialogFragment.java:106)  at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:312)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1113)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1682)  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:541)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5590)  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:1268)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)  at dalvik.system.NativeStart.main(Native Method)  Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f010000 a=-1} at android.content.res.Resources.loadDrawable(Resources.java:3425) at android.content.res.TypedArray.getDrawable(TypedArray.java:614) at android.view.View.<init>(View.java:3585) at android.view.View.<init>(View.java:3515) at android.view.ViewGroup.<init>(ViewGroup.java:464) at android.widget.RelativeLayout.<init>(RelativeLayout.java:236) at java.lang.reflect.Constructor.constructNative(Native Method)  at java.lang.reflect.Constructor.newInstance(Constructor.java:423)  at android.view.LayoutInflater.createView(LayoutInflater.java:601)  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:676)  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:701)  at android.view.LayoutInflater.rInflate(LayoutInflater.java:762)  at android.view.LayoutInflater.inflate(LayoutInflater.java:499)  at android.view.LayoutInflater.inflate(LayoutInflater.java:398)  at android.view.LayoutInflater.inflate(LayoutInflater.java:354)  at com.kunzisoft.switchdatetime.SwitchDateTimeDialogFragment.onCreateDialog(SwitchDateTimeDialogFragment.java:106)  at android.support.v4.app.DialogFragment.getLayoutInflater(DialogFragment.java:312)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1113)  at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1295)  at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:801)  at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1682)  at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:541)  at android.os.Handler.handleCallback(Handler.java:733)  at android.os.Handler.dispatchMessage(Handler.java:95)  at android.os.Looper.loop(Looper.java:136)  at android.app.ActivityThread.main(ActivityThread.java:5590)  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:1268)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1084)  at dalvik.system.NativeStart.main(Native Method) 

@J-Jamet
Copy link
Member

J-Jamet commented Nov 12, 2016

Hi, can you explain how exception is thrown ?

@pranavlathigara
Copy link
Author

open DateTime dialog in my app dialog...

@J-Jamet
Copy link
Member

J-Jamet commented Nov 28, 2016

Is your problem resolved with the new version?

@traabefi
Copy link

I am getting the same error. If I launch the sample, on clicking the button everything crashes with the same error

@traabefi
Copy link

Solved it by removing app theme attribute from your manifest

@J-Jamet
Copy link
Member

J-Jamet commented Nov 30, 2016

It's now solved with 1.2 version. Can you confirm ?

@pranavlathigara
Copy link
Author

ok let me test...

@vik17ag
Copy link

vik17ag commented Dec 10, 2016

Hi,
I am getting same error, and its not solved with version 1.2
Could you elaborate how did you remove app theme in manifest?
I am using android/;theme = "@style/AppTheme.NoActionbar"

thanks

@J-Jamet
Copy link
Member

J-Jamet commented Dec 10, 2016

Hi,
you need to use a Theme.AppCompat style (or descendant) with SwitchDateTime's activity. (I'll put it in bold in the documentation)
The manifest of "swidatetime" module doesn't contain @style/Theme.SwitchDateTime but in SwitchDateTimeDialogFragment, the theme is imported with
getActivity().getTheme().applyStyle(R.style.Theme_SwitchDateTime, false);
(who is a descendant of Theme.AppCompat), and uses custom arguments.
You can redefine each item in the theme separately but each variable's item must be redefined.

Your manifest can be like

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.kunzisoft.switchdatetimesample">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionbar"
        android:supportsRtl="true">
        <activity
            android:name="com.kunzisoft.switchdatetimesample.Sample"
            android:theme="@style/MyAppCustomTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

With MyAppCustomTheme a Theme.AppCompat theme.

@srgiitd
Copy link

srgiitd commented Dec 18, 2016

Tested your sample on Samsung GT-7562 (Android 4.0.4, API 15) device and it crashes with the same issue as mentioned above. It works fine on my Nexus 4 and Nexus 5 devices. Looks like an unreliable widget.

@J-Jamet
Copy link
Member

J-Jamet commented Dec 19, 2016

Thx srgiitd for your reply. I finally identify the problem. In versions before Lollipop, it is impossible to use app:arg="?attr/customColorAttr" in views. Android logs and docs are not clear at all. I have solution, add "id style" parameters for TypedArray. I'm making a new version.

@J-Jamet
Copy link
Member

J-Jamet commented Dec 19, 2016

SwitchDateTimePicker 1.3 solve issue with API < 21

@J-Jamet J-Jamet closed this as completed Dec 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants