Activity无法打开,闪退

1、问题描述:

FATAL EXCEPTION: main
Process: com.example.leidong.myapp, PID: 4506
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.leidong.myapp/com.example.leidong.myapp.loginAndRegister.UserRegister}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.

2、解决方案:
查看界面的Activity是否继承Activity类。

Activity跳转闪退

11-24

MainActivity.javarn[code=java]rnpackage com.yau.jsj;rnrnimport android.os.Bundle;rnimport android.app.Activity;rnimport android.content.Intent;rnimport android.view.View;rnimport android.widget.AdapterView;rnimport android.widget.AdapterView.OnItemClickListener;rnimport android.widget.ArrayAdapter;rnimport android.widget.ListView;rnimport android.widget.Toast;rnrnpublic class MainActivity extends Activity rnrn private ListView lv;rn private String[] mainOptions;rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_main);rnrn lv = (ListView) findViewById(R.id.listview);rn mainOptions = getResources().getStringArray(R.array.mainOptions);rnrn lv.setAdapter(new ArrayAdapter(this,rn android.R.layout.simple_list_item_1, mainOptions));rnrn lv.setOnItemClickListener(new OnItemClickListener() rnrn @Overridern public void onItemClick(AdapterView parent, View view,rn int position, long id) rn // Toast.makeText(MainActivity.this,rn // Integer.toString(position),2000).show();rn Intent intent = new Intent();rn switch (position) rn case 0:rn intent.setClass(MainActivity.this, activity00.class);rn startActivity(intent);rn break;rn rn rnrn );rn rnrnrnrn[/code]rnrnrnactivity00.javarn[code=java]rnpackage com.yau.jsj;rnrnimport android.app.Activity;rnimport android.os.Bundle;rnrnpublic class activity00 extends Activity rn @Overridern protected void onCreate(Bundle savedInstanceState) rn // TODO Auto-generated method stubrn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity00);rn rnrnrn[/code]rnrn初学android,自己写的ListView,想进行Activity之间的跳转,但是跳转便会闪退,提示unfortunately ListView has stopped,rn

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试