的InvocationTargetException在膨胀的XML - 机器人 [英] InvocationTargetException on inflating an xml - android

查看:152
本文介绍了的InvocationTargetException在膨胀的XML - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个code的工作99%的时间,因为就是部署大量客户端,但有时我得到如下:

I have a code that works 99% of the time since is deploy in lots of clients, but sometimes I get the following:

java.lang.reflect.InvocationTargetException     android.widget.LinearLayout(LinearLayout.java:92)       java.lang.reflect.Constructor.constructNative(本机方法)       java.lang.reflect.Constructor.newInstance(Constructor.java:446)       android.view.LayoutInflater.createView(LayoutInflater.java:499)       com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)       android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)       android.view.LayoutInflater.rInflate(LayoutInflater.java:617)       android.view.LayoutInflater.inflate(LayoutInflater.java:407)       android.view.LayoutInflater.inflate(LayoutInflater.java:320)       com.my code.my code.MyClass.draw(XXXXXXX)   ......

java.lang.reflect.InvocationTargetException android.widget.LinearLayout.(LinearLayout.java:92) java.lang.reflect.Constructor.constructNative(Native Method) java.lang.reflect.Constructor.newInstance(Constructor.java:446) android.view.LayoutInflater.createView(LayoutInflater.java:499) com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56) android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562) android.view.LayoutInflater.rInflate(LayoutInflater.java:617) android.view.LayoutInflater.inflate(LayoutInflater.java:407) android.view.LayoutInflater.inflate(LayoutInflater.java:320) com.mycode.mycode.MyClass.draw(xxxxxxx) .....

和我的code,我有:

and on my code I have:

LayoutInflater李=(LayoutInflater)本                       .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              theview = li.inflate(R.layout.partofthescreen,                       somecontainer,假);

LayoutInflater li = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
theview = li.inflate(R.layout.partofthescreen, somecontainer, false);

所以,问题是为什么我收到的InvocationTargetException。

so the question is why I am getting InvocationTargetException.

感谢

推荐答案

您可以尝试 getLayoutInflater(),而不是你的 getSystemService()打电话,虽然我不知道这会有所作为。

You can try getLayoutInflater() instead of your getSystemService() call, though I am not sure that will make a difference.

这是的InvocationTargetException 来自反思,意味着方法被调用抛出了一个异常。你看到的可能是潜在的异常另一个堆栈跟踪任何迹象?如果没有,尝试捕捉的InvocationTargetException 看着的getCause()来看看什么是真正回事。

An InvocationTargetException comes from reflection, and means the Method that was invoked threw an Exception. Do you see any sign of another stack trace that might be the underlying Exception? If not, try catching InvocationTargetException and looking at getCause() to see what is really going on.

这篇关于的InvocationTargetException在膨胀的XML - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆