freshworks / mobihelp-android

MIT License
15 stars 13 forks source link

Error applying Custom Theme in SolutionsActivity #12

Closed gaurav-gupta83 closed 9 years ago

gaurav-gupta83 commented 9 years ago

I am facing the getting following 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.

tryprasannan commented 9 years ago

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(mhic*) from the equivalent Mobihelp theme. Eg. If the custom theme is a light theme, include the attributes from the equivalent Mobihelp theme Theme.MobihelpSDK.Light present in res/values/themes.xml in the custom theme. The icons are based on these attributes.