I am trying to close my App when i press on the Back Button, all it does is just going back to Launcher Activity.
public void onBackPressed() {
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
System.exit(0);
finish();
}
I tried both, System.exit(1) and System.exit(0), together and each other alone. But nothing works as intended.
EDIT:
I have changed it to
linearLayout_wrapper.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
scrollView.addView(linearLayout_wrapper);
Log.i("Main", "initialize menu layout: complete");
}
protected void onDestroy(){
android.os.Process.killProcess(android.os.Process.myPid());
super.onDestroy();
}
public void onBackPressed() {
finish();
}
And now i get an exception when i press the back button
java.lang.IllegalStateException: ScrollView can host only one direct child