这些是我的活动代码
@Override
protected void onCreate(Bundle savedInstanceState) {
Logger.i(TAG, "onCreate");
super.onCreate(savedInstanceState);
MobclickAgent.onError(this);
setContentView(R.layout.mytrips);
initializeIntent();
initView();
}
当我运行活动时,logcat会发生错误。
01-17 12:41:04.748: E/ActivityThread(6632): Failed to inflate
01-17 12:41:04.748: E/ActivityThread(6632): android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
01-17 12:41:04.748: E/ActivityThread(6632): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
01-17 12:41:04.748: E/ActivityThread(6632): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
01-17 12:41:04.748: E/ActivityThread(6632): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
01-17 12:41:04.748: E/ActivityThread(6632): at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
01-17 12:41:04.748: E/ActivityThread(6632): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
01-17 12:41:04.748: E/ActivityThread(6632): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
01-17 12:41:04.748: E/ActivityThread(6632): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.Activity.setContentView(Activity.java:1657)
01-17 12:41:04.748: E/ActivityThread(6632): at com.blsm.yepcolor.ui.MyTripsActivity.onCreate(MyTripsActivity.java:69)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
01-17 12:41:04.748: E/ActivityThread(6632): at android.os.Handler.dispatchMessage(Handler.java:99)
01-17 12:41:04.748: E/ActivityThread(6632): at android.os.Looper.loop(Looper.java:123)
01-17 12:41:04.748: E/ActivityThread(6632): at android.app.ActivityThread.main(ActivityThread.java:3835)
01-17 12:41:04.748: E/ActivityThread(6632): at java.lang.reflect.Method.invokeNative(Native Method)
01-17 12:41:04.748: E/ActivityThread(6632): at java.lang.reflect.Method.invoke(Method.java:507)
01-17 12:41:04.748: E/ActivityThread(6632): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
01-17 12:41:04.748: E/ActivityThread(6632): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
01-17 12:41:04.748: E/ActivityThread(6632): at dalvik.system.NativeStart.main(Native Method)
01-17 12:41:04.748: E/ActivityThread(6632): Caused by: java.lang.reflect.InvocationTargetException
01-17 12:41:04.748: E/ActivityThread(6632): at java.lang.reflect.Constructor.constructNative(Native Method)
01-17 12:41:04.748: E/ActivityThread(6632): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
01-17 12:41:04.748: E/ActivityThread(6632): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
01-17 12:41:04.748: E/ActivityThread(6632): ... 21 more
请帮我解决这个问题。
答案 0 :(得分:0)
在对布局文件进行充气时,以下行存在问题
setContentView(R.layout.mytrips);