[code=Java]代码如下:
第一个Activity:
package com.shao.Activity;import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;public class Activity02 extends Activity {
    /** Called when the activity is first created. */
private Button myButton=null;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        myButton = (Button)findViewById(R.id.myButton);
        myButton.setText(R.string.Button);
        myButton.setOnClickListener(new MyButtonListener());
    }
    class MyButtonListener implements OnClickListener{ @Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
intent.setClass(Activity02.this, OtherActivity.class);
Activity02.this.startActivity(intent);

}    
    }
}
第二个Activity:
package com.shao.Activity;import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;public class OtherActivity extends Activity{
private TextView myTextView=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.other);
myTextView=(TextView)findViewById(R.id.myTextView);
myTextView.setText(R.string.other);
}}
AndroidManifest代码:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.shao.Activity"
    android:versionCode="1"
    android:versionName="1.0" >    <uses-sdk android:minSdkVersion="7" 
                  android:targetSdkVersion="8"/>
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".Activity02"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".OtherActivity" android:label="@string/other"/>
    </application></manifest>

解决方案 »

  1.   

    android:label="@string/other"/   你在value的XML文件里面写other了吗,然后你的问题具体是什么呢?
      

  2.   

    就是不能切换到另一个Activity点击按钮就会结束进程
      

  3.   

    写了 问题就是不能切换到另一个Activity点击按钮就会结束进程
      

  4.   

    1、建议R.layout.other代码上来;
    2、建议将详细报错Log发上来。
      

  5.   


    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >    <Textiew
            android:id="@+id/myTextView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            /></LinearLayout>
      

  6.   

    06-03 01:38:38.079: D/AndroidRuntime(390): Shutting down VM
    06-03 01:38:38.089: W/dalvikvm(390): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
    06-03 01:38:38.128: E/AndroidRuntime(390): FATAL EXCEPTION: main
    06-03 01:38:38.128: E/AndroidRuntime(390): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shao.Activity/com.shao.Activity.OtherActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class Textiew
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.os.Handler.dispatchMessage(Handler.java:99)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.os.Looper.loop(Looper.java:123)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.ActivityThread.main(ActivityThread.java:4627)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at java.lang.reflect.Method.invokeNative(Native Method)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at java.lang.reflect.Method.invoke(Method.java:521)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at dalvik.system.NativeStart.main(Native Method)
    06-03 01:38:38.128: E/AndroidRuntime(390): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class Textiew
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:576)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.Activity.setContentView(Activity.java:1647)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at com.shao.Activity.OtherActivity.onCreate(OtherActivity.java:13)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    06-03 01:38:38.128: E/AndroidRuntime(390):  ... 11 more
    06-03 01:38:38.128: E/AndroidRuntime(390): Caused by: java.lang.ClassNotFoundException: android.view.Textiew in loader dalvik.system.PathClassLoader[/data/app/com.shao.Activity-2.apk]
    06-03 01:38:38.128: E/AndroidRuntime(390):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.createView(LayoutInflater.java:466)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:544)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
    06-03 01:38:38.128: E/AndroidRuntime(390):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
    06-03 01:38:38.128: E/AndroidRuntime(390):  ... 20 more
      

  7.   

    请看这一行 Binary XML file line #7: Error inflating class Textiew和这一行06-03 01:38:38.128: E/AndroidRuntime(390): at com.shao.Activity.OtherActivity.onCreate(OtherActivity.java:13)
    应该是R.layout.other这个XML文件有问题
      

  8.   

    问题很明显:
    Error inflating class Textiew单词拼写错误Textiew  ->  TextView