I am making an application that I dont want it to close. So on the onClose() function in the mainScreen I am writing this code:
public boolean onClose() {
UiApplication.getUiApplication().requestBackground();
UiApp.getInstance().acceptsForeground = false;
return false;
}
And on the UiApp class that extends UiApplication, I am overriding the acceptsForeground function to do the following:
protected boolean acceptsForeground() {
return acceptsForeground;
}
When closing the application by choosing the exit from the menu, the icon disappers from the running applications without being closed in real. But the problem is that I am not being able to make it run again because of the return false value.
So how to make an application hide without having its icon displayed in the task switcher?
1.If you want to hide the application in “Switch Application“:
2.And if you want to run the application in Background, write this below code in the class which extends MainScreen: