单击Pay按钮Payfort PaymentGateway android SDK<获取InflateException类com.shamanland.fonticon.FontIconView>

时间:2016-09-20 12:26:26

标签: android payfort

我正在将Payfort Payment gateway android sdk集成到我的应用程序中,每件事情都运行良好,直到使用sdk在最后一个屏幕上付款。 当点击Payfort团队提供的XML设计上的PAY按钮时,我正在

{
        if (isInEditMode()) {
            mOldValuesSaver = null;
        } else {
            setTypeface(FontIconTypefaceHolder.getTypeface());
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                mOldValuesSaver = new Runnable() {
                    @Override
                    public void run() {
                        saveOldValues();
                    }
                };
            } else {
                mOldValuesSaver = new Runnable() {
                    @Override
                    public void run() {
                        saveOldValuesJB();
                    }
                };
            }
        }
    }

在上面的方法中,行(setTypeface(FontIconTypefaceHolder.getTypeface());)抛出以下错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.payfort.payfort/com.example.payfort.payfort.MainActivity}: android.view.InflateException: Binary XML file line #15: Error inflating class com.shamanland.fonticon.FontIconView

任何帮助将不胜感激。 请找到下面的日志

  

/com.example.payfort.payfort E / AndroidRuntime:FATAL EXCEPTION:main   过程:com.example.payfort.payfort,PID:23352   java.lang.RuntimeException:无法启动活动   ComponentInfo {com.example.payfort.payfort / com.example.payfort.payfort.MainActivity}:   android.view.InflateException:二进制XML文件行#15:错误   膨胀类com.shamanland.fonticon.FontIconView at   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)   在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)   在android.app.ActivityThread.access $ 800(ActivityThread.java:151)at   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)   在android.os.Handler.dispatchMessage(Handler.java:102)at   android.os.Looper.loop(Looper.java:135)at   android.app.ActivityThread.main(ActivityThread.java:5254)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:903)   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)引起   by:android.view.InflateException:二进制XML文件行#15:错误   膨胀类com.shamanland.fonticon.FontIconView at   android.view.LayoutInflater.createView(LayoutInflater.java:633)at   android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)   在android.view.LayoutInflater.rInflate(LayoutInflater.java:806)at   android.view.LayoutInflater.rInflate(LayoutInflater.java:809)at   android.view.LayoutInflater.inflate(LayoutInflater.java:504)at   android.view.LayoutInflater.inflate(LayoutInflater.java:414)at   android.view.LayoutInflater.inflate(LayoutInflater.java:365)at   android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)   在   android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)   在   com.example.payfort.payfort.MainActivity.onCreate(MainActivity.java:52)   在android.app.Activity.performCreate(Activity.java:5990)处   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)   在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)   在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)   在android.app.ActivityThread.access $ 800(ActivityThread.java:151)at   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)   在android.os.Handler.dispatchMessage(Handler.java:102)at   android.os.Looper.loop(Looper.java:135)at   android.app.ActivityThread.main(ActivityThread.java:5254)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:903)   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)引起   by:java.lang.reflect.InvocationTargetException at   java.lang.reflect.Constructor.newInstance(Native Method)at   java.lang.reflect.Constructor.newInstance(Constructor.java:288)at   android.view.LayoutInflater.createView(LayoutInflater.java:607)at   android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)   在android.view.LayoutInflater.rInflate(LayoutInflater.java:806)at   android.view.LayoutInflater.rInflate(LayoutInflater.java:809)at   android.view.LayoutInflater.inflate(LayoutInflater.java:504)at   android.view.LayoutInflater.inflate(LayoutInflater.java:414)at   android.view.LayoutInflater.inflate(LayoutInflater.java:365)at   android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)   在   android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)   在   com.example.payfort.payfort.MainActivity.onCreate(MainActivity.java:52)   在android.app.Activity.performCreate(Activity.java:5990)处   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)   在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)   在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)   在android.app.ActivityThread.access $ 800(ActivityThread.java:151)at   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)   在android.os.Handler.dispatchMessage(Handler.java:102)at   android.os.Looper.loop(Looper.java:135)at   android.app.ActivityThread.main(ActivityThread.java:5254)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:903)   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)引起   by:java.lang.IllegalStateException at   com.shamanland.fonticon.FontIconTypefaceHolder.getTypeface(FontIconTypefaceHolder.java:13)   在com.shamanland.fonticon.FontIconView。(FontIconView.java:129)   at java.lang.reflect.Constructor.newInstance(Native Method)at   java.lang.reflect.Constructor.newInstance(Constructor.java:288)at   android.view.LayoutInflater.createView(LayoutInflater.java:607)at   android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)   在android.view.LayoutInflater.rInflate(LayoutInflater.java:806)at   android.view.LayoutInflater.rInflate(LayoutInflater.java:809)at   android.view.LayoutInflater.inflate(LayoutInflater.java:504)at   android.view.LayoutInflater.inflate(LayoutInflater.java:414)at   android.view.LayoutInflater.inflate(LayoutInflater.java:365)at   android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:280)   在   android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)   在   com.example.payfort.payfort.MainActivity.onCreate(MainActivity.java:52)   在android.app.Activity.performCreate(Activity.java:5990)处   android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)   在   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)   在   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)   在android.app.ActivityThread.access $ 800(ActivityThread.java:151)at   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1303)   在android.os.Handler.dispatchMessage(Handler.java:102)at   android.os.Looper.loop(Looper.java:135)at   android.app.ActivityThread.main(ActivityThread.java:5254)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:903)   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

1 个答案:

答案 0 :(得分:0)

添加

FontIconTypefaceHolder.init(getAssets(), "icons.ttf"); 
在setcontentview之前