Android菜鸟问一个sorry the application Activity_03 has stopped unexpected的问题

遗天补 发布于 2014/02/12 16:20
阅读 826
收藏 0

按照安卓开发视频教程写得代码,当用模拟器运行时出现了sorry the application Activity_03 has stopped unexpected。本人菜鸟希望大神求教啊

这个是代码package com.mars.activity_03;


import android.os.Bundle;
import android.app.Activity;
import android.view.MenuItem;
import android.content.Intent;
import android.view.Menu;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.view.View.OnClickListener;
import android.view.View;


public class Activity03 extends Activity {
     private EditText factorOne=null;
     private EditText factorTwo=null;
     private TextView symbol=null;
     private Button calculate=null; 
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
factorOne = (EditText)findViewById(R.id.factorOne);
        factorTwo = (EditText)findViewById(R.id.factorTwo);
        symbol =(TextView)findViewById(R.id.symbol);
        calculate = (Button)findViewById(R.id.calculate);
        symbol.setText(R.string.symbol);
        calculate.setText(R.string.calculate);
        calculate.setOnClickListener(new CalculateListener());
        
}
class CalculateListener implements OnClickListener{


@Override
public void onClick(View v) {
String factorOneStr = factorOne.getText().toString();
String factorTwoStr = factorTwo.getText().toString();
Intent intent = new Intent();
intent.putExtra("one",factorOneStr);
intent.putExtra("two",factorTwoStr);
intent.setClass(Activity03.this,ResultActivity.class);
Activity03.this.startActivity(intent);
}


}




}



下面的是logcat的错误信息跪求指点

02-12 07:54:15.808: E/dalvikvm(437): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

02-12 08:02:43.157: E/AndroidRuntime(470): Uncaught handler: thread main exiting due to uncaught exception
02-12 08:02:43.167: E/AndroidRuntime(470): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mars.activity_03/com.mars.activity_03.Activity03}: android.view.InflateException: Binary XML file line #2: Error inflating class LineLayout
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.ActivityThread.access$2100(ActivityThread.java:116)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.os.Handler.dispatchMessage(Handler.java:99)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.os.Looper.loop(Looper.java:123)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.ActivityThread.main(ActivityThread.java:4203)
02-12 08:02:43.167: E/AndroidRuntime(470): at java.lang.reflect.Method.invokeNative(Native Method)
02-12 08:02:43.167: E/AndroidRuntime(470): at java.lang.reflect.Method.invoke(Method.java:521)
02-12 08:02:43.167: E/AndroidRuntime(470): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
02-12 08:02:43.167: E/AndroidRuntime(470): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
02-12 08:02:43.167: E/AndroidRuntime(470): at dalvik.system.NativeStart.main(Native Method)
02-12 08:02:43.167: E/AndroidRuntime(470): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class LineLayout
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:575)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
02-12 08:02:43.167: E/AndroidRuntime(470): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.Activity.setContentView(Activity.java:1620)
02-12 08:02:43.167: E/AndroidRuntime(470): at com.mars.activity_03.Activity03.onCreate(Activity03.java:22)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
02-12 08:02:43.167: E/AndroidRuntime(470): ... 11 more
02-12 08:02:43.167: E/AndroidRuntime(470): Caused by: java.lang.ClassNotFoundException: android.view.LineLayout in loader dalvik.system.PathClassLoader@43757cb8
02-12 08:02:43.167: E/AndroidRuntime(470): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
02-12 08:02:43.167: E/AndroidRuntime(470): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
02-12 08:02:43.167: E/AndroidRuntime(470): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.createView(LayoutInflater.java:465)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:543)
02-12 08:02:43.167: E/AndroidRuntime(470): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
02-12 08:02:43.167: E/AndroidRuntime(470): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
02-12 08:02:43.167: E/AndroidRuntime(470): ... 19 more
02-12 08:02:43.217: E/dalvikvm(470): Unable to open stack trace file '/data/anr/traces.txt': Permission denied

加载中
0
zhangqing
zhangqing

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mars.activity_03/com.mars.activity_03.Activity03}: android.view.InflateException: Binary XML file line #2: Error inflating class LineLayout

LinearLayout写错了。。Activity_03的xml


0
遗天补

引用来自“zhangqing”的答案

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mars.activity_03/com.mars.activity_03.Activity03}: android.view.InflateException: Binary XML file line #2: Error inflating class LineLayout

LinearLayout写错了。。Activity_03的xml


不错,谢谢了哈
返回顶部
顶部