public class SMSManager extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ImageButton btnShowPeople=(ImageButton)this.findViewById(R.id.ShowPeople);
        btnShowPeople.setOnClickListener(mBtnShowPeopleClick);
    }
    
    private OnClickListener mBtnShowPeopleClick=new OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent i=new Intent();
i.setClass(SMSManager.this, ShowPeopleList.class);
startActivity(i);
}
};
    
}package com.cxy.SMSManager;import android.app.ListActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;public class ShowPeopleList extends ListActivity {
@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        setListAdapter(new ArrayAdapter<String>(this,
                android.R.layout.simple_list_item_multiple_choice, GENRES));
        
        final ListView listView = getListView();        listView.setItemsCanFocus(false);
        listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    }
    private static final String[] GENRES = new String[] {
        "Action", "Adventure", "Animation", "Children", "Comedy", "Documentary", "Drama",
        "Foreign", "History", "Independent", "Romance", "Sci-Fi", "Television", "Thriller"
    };
}
为什么当startActivity的时候我的程序会崩溃,有高手能帮我看看不,小弟是新手

解决方案 »

  1.   

    加一句:
    setContentView(R.layout.list);list.xml内容:
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >
        <ListView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@id/android:list"/>
    </LinearLayout>就可以啦
      

  2.   

    看看 ShowPeopleList 这个activity有没有在AndroidManifest.xml文件中声明。
      

  3.   

    同一楼
    ShowPeopleList这个类得onCreate方法中加个setContentView(R.layout.unnamed);
      

  4.   

    问题是没在MANIFEST.XML中注册ShowPeopleList这个ACITITY
      

  5.   

    adb logcat -v time
    根据错误信息进行debug