标签:android
新建activity分以下几部:
(1)在 /src/main/res/layout/ 中新建activity_second.xml
(2)在 /src/main/java 中新建 SecondActivity.java ,且内容如下:
public class SecondActivity extends Activity{
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
}
(3)在AndroidMainfest.xml中“注册”下:
<activity android:name=".SecondActivity">
</activity>
没有提示出错,运行时出现error提示:
java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
解决方法:MainActivity.java中MainActivity extends ActionBarActivity改为MainActivity extends Activity
Android studio新建activity运行出错解决方法
标签:android
原文地址:http://blog.csdn.net/sjtu_chenchen/article/details/45875743