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
Asked
Active
Viewed 39 times
-3
-
Please post some code & the stacktrace. – Darshan Jun 27 '22 at 18:34
-
2Check this **[unfortunately-myapp-has-stopped-how-can-i-solve-this](https://stackoverflow.com/q/23353173/7666442)** – AskNilesh Jun 27 '22 at 18:44
1 Answers
0
The method setContentView()
sets the View
that your MainActivity
should display.
The View
is usually declared in 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.
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).

Cactusroot
- 1,019
- 3
- 16