Activity跳转闪退
MainActivity.java
package com.yau.jsj;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
public class MainActivity extends Activity {
private ListView lv;
private String[] mainOptions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lv = (ListView) findViewById(R.id.listview);
mainOptions = getResources().getStringArray(R.array.mainOptions);
lv.setAdapter(new ArrayAdapter(this,
android.R.layout.易做图_list_item_1, mainOptions));
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// Toast.makeText(MainActivity.this,
// Integer.toString(position),2000).show();
Intent intent = new Intent();
switch (position) {
case 0:
intent.setClass(MainActivity.this, activity00.class);
startActivity(intent);
break;
}
}
});
}
}
activity00.java
package com.yau.jsj;
import android.app.Activity;
import android.os.Bundle;
public class activity00 extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity00);
}
}
初学android,自己写的ListView,想进行Activity之间的跳转,但是跳转便会闪退,提示unfortunately ListView has stopped,
android ListView Intent --------------------编程问答-------------------- 看看Manifest文件中有没有注册跳转的Activity..
activity00 --------------------编程问答-------------------- 能不能把logcat日志贴出来 --------------------编程问答-------------------- Manifest文件中加上activity00 --------------------编程问答-------------------- 看代码没问题,就像楼上说的看看Manifest里面是不是注册了你要用的activity,再就是看看logcat里面包得什么错,应该很容易看到问题
补充:移动开发 , Android