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

Not compatible with Material theme? #6

Closed
MufriA opened this Issue Jan 17, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@MufriA

MufriA commented Jan 17, 2015

I get below crash when I remove all theme attributes from sdk's AndroidManifest.xml

01-17 19:12:13.190    1723-1723/com.mufri.authenticatorplus.debug E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.mufri.authenticatorplus.debug, PID: 1723
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mufri.authenticatorplus.debug/com.freshdesk.mobihelp.activity.SolutionArticleListActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setDisplayHomeAsUpEnabled(boolean)' on a null object reference
            at com.freshdesk.mobihelp.e.t.a(Unknown Source)
            at com.freshdesk.mobihelp.activity.SolutionArticleListActivity.onCreate(Unknown Source)
            at android.app.Activity.performCreate(Activity.java:5933)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
            at android.app.ActivityThread.access$800(ActivityThread.java:144)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:135)
            at android.app.ActivityThread.main(ActivityThread.java:5221)
            at java.lang.reflect.Method.invoke(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:372)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

In material theme we need to first set the toolbar before we invoke setDisplayHomeAsUpEnabled, below code works inside my activities

        mToolbar = (Toolbar) findViewById(R.id.toolbar);
        if (mToolbar != null) {
            setSupportActionBar(mToolbar);
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
@tryprasannan

This comment has been minimized.

Show comment
Hide comment
@tryprasannan

tryprasannan Jan 18, 2015

Contributor

When using a custom theme with Mobihelp SDK,

  1. Ensure the custom theme inherits from one of the variants of Theme.AppCompat
  2. The custom theme must also include the attributes from the equivalent Mobihelp theme.
    Eg. If the theme is light theme, include the attributes from the theme Theme.MobihelpSDK.Light present in res/values/themes.xml in the custom theme. The icons are based on these attributes.

If it still doesn't work, please let us know. Thanks.

Contributor

tryprasannan commented Jan 18, 2015

When using a custom theme with Mobihelp SDK,

  1. Ensure the custom theme inherits from one of the variants of Theme.AppCompat
  2. The custom theme must also include the attributes from the equivalent Mobihelp theme.
    Eg. If the theme is light theme, include the attributes from the theme Theme.MobihelpSDK.Light present in res/values/themes.xml in the custom theme. The icons are based on these attributes.

If it still doesn't work, please let us know. Thanks.

@MufriA

This comment has been minimized.

Show comment
Hide comment
@MufriA

MufriA Jan 18, 2015

@tryprasannan For material theme extending Theme.AppCompat mandatory so I already do already, refer the code i use.

I do have theme attribs, but from logs its clear SDK is invoking setDisplayHomeAsUpEnabled before setSupportActionBar, this is mandatory in material theme because by default material themes don't have a toolbar unlike previous releases, we need to add toolbar manually. FYI i use appcompat-v7:21.0.3

MufriA commented Jan 18, 2015

@tryprasannan For material theme extending Theme.AppCompat mandatory so I already do already, refer the code i use.

I do have theme attribs, but from logs its clear SDK is invoking setDisplayHomeAsUpEnabled before setSupportActionBar, this is mandatory in material theme because by default material themes don't have a toolbar unlike previous releases, we need to add toolbar manually. FYI i use appcompat-v7:21.0.3

@tryprasannan

This comment has been minimized.

Show comment
Hide comment
@tryprasannan

tryprasannan Feb 20, 2015

Contributor

We support toolbar in the latest release v1.3.1 of Mobihelp SDK with appcompat-v7 r21+

Contributor

tryprasannan commented Feb 20, 2015

We support toolbar in the latest release v1.3.1 of Mobihelp SDK with appcompat-v7 r21+

@gaurav-gupta83

This comment has been minimized.

Show comment
Hide comment
@gaurav-gupta83

gaurav-gupta83 Apr 1, 2015

I am facing the same issue when I remove all theme attributes from sdk's AndroidManifest.xml

Unable to start activity ComponentInfo{com.Kochar.IT.GizmoControl/com.freshdesk.mobihelp.activity.SolutionArticleListActivity}: android.view.InflateException: Binary XML file line #27: Error inflating class

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5433)
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.view.InflateException: Binary XML file line #27: Error inflating class
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.rInflate(LayoutInflater.java:771)
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 android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
at com.freshdesk.mobihelp.activity.SolutionArticleListActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:5301)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2291)
... 11 more
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)
... 25 more
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f0100ac a=-1}
: at android.content.res.Resources.loadDrawable(Resources.java:3423)
at android.content.res.TypedArray.getDrawable(TypedArray.java:614)
at android.widget.ImageView.(ImageView.java:134)

Please help.

gaurav-gupta83 commented Apr 1, 2015

I am facing the same issue when I remove all theme attributes from sdk's AndroidManifest.xml

Unable to start activity ComponentInfo{com.Kochar.IT.GizmoControl/com.freshdesk.mobihelp.activity.SolutionArticleListActivity}: android.view.InflateException: Binary XML file line #27: Error inflating class

at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2327)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2378)
at android.app.ActivityThread.access$800(ActivityThread.java:155)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1244)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5433)
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.view.InflateException: Binary XML file line #27: Error inflating class
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.rInflate(LayoutInflater.java:771)
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 android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:228)
at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
at com.freshdesk.mobihelp.activity.SolutionArticleListActivity.onCreate(Unknown Source)
at android.app.Activity.performCreate(Activity.java:5301)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2291)
... 11 more
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)
... 25 more
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f0100ac a=-1}
: at android.content.res.Resources.loadDrawable(Resources.java:3423)
at android.content.res.TypedArray.getDrawable(TypedArray.java:614)
at android.widget.ImageView.(ImageView.java:134)

Please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment