这是logcat
通过intent跳转activity  ecplise没提示错误但是程序不能运行 多谢各位前辈啦android

解决方案 »

  1.   

    有没有在AndroidManifest.xml中把所有的Activity都注册了?把代码贴上来看一下吧
      

  2.   

    package com.example.shishenxuanze;import android.os.Bundle;
    import android.app.Activity;
    import android.content.DialogInterface;
    import android.content.DialogInterface.OnClickListener;
    import android.content.Intent;
    import android.view.Menu;
    import android.widget.Button;public class Shishenxuanze extends Activity {
    private Button button1 = null; @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_shishenxuanze);
    button1 = (Button)findViewById(R.id.button1);
    button1.setOnClickListener((android.view.View.OnClickListener) new MyButtonListener());

    }
       class MyButtonListener implements OnClickListener{ @Override
    public void onClick(DialogInterface arg0, int arg1) {
    // TODO Auto-generated method stub
    Intent intent = new Intent();
    intent.setClass(Shishenxuanze.this, Zishibu.class);
    Shishenxuanze.this.startActivity(intent);
    }
       
       
       }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.shishenxuanze, menu);
    return true;
    }}
    这是第一个activity
    package com.example.shishenxuanze;import android.app.Activity;
    import android.os.Bundle;
    import android.widget.ImageView;public class Zishibu extends Activity {
    private ImageView imageview1 = null; @Override
    protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.zishibu);
    imageview1 = (ImageView)findViewById(R.id.imageView1);
    }}
    第二个activity
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.shishenxuanze"
        android:versionCode="1"
        android:versionName="1.0" >    <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17" />    <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <activity
                android:name="com.example.shishenxuanze.Shishenxuanze"
                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="com.example.shishenxuanze.Zishibu"
                      android:label="@string/app_name"/>
        </application></manifest>
    AndroidMainfest.xml
      

  3.   

    你把 Shishenxuanze这个类名换成别的名字试试
      

  4.   

    我记得貌似button用的onclick后面应该是  onclick(View v){......}吧
      

  5.   

    class MyButtonListener implements OnClickListener{@Override
    public void onClick(DialogInterface arg0, int arg1)
    这个方法引用错了,应该是public void onClick(View v)