[英]I have run error at on Create on Android studio
I get a massage says "app is keep stopping" when I run the project on my mobile.当我在我的手机上运行项目时,我得到一个按摩说“应用程序一直在停止”。 the error at on Create(MainActivity.java:16) at the line 16 set Content View method help me
第 16 行的 Create(MainActivity.java:16) 上的错误设置内容视图方法帮助我
The method setContentView()
sets the View
that your MainActivity
should display.方法
setContentView()
设置您的MainActivity
应该显示的View
。
The View
is usually declared in layout/activity_main.xml
. View
通常在layout/activity_main.xml
中声明。
Some error seems to appear when trying to call this method in your application.尝试在应用程序中调用此方法时似乎出现了一些错误。
A common reason why android applications crash there is calling some methods in the overridden method onCreate(Bundle savedInstanceState)
in a wrong order. android 应用程序崩溃的一个常见原因是在被覆盖的方法
onCreate(Bundle savedInstanceState)
中以错误的顺序调用某些方法。
Check if your code follows this pattern:检查您的代码是否遵循以下模式:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// setContentView call
// other things
}
I cannot help you further now, please copy and paste the stacktrace (crash information) into your question.我现在无法进一步帮助您,请将堆栈跟踪(崩溃信息)复制并粘贴到您的问题中。 When your application just crashed on an emulator, you can see it in the Run-section (usually red text).
当您的应用程序刚刚在模拟器上崩溃时,您可以在运行部分看到它(通常是红色文本)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.