I am making an app, but there are basically two different, albeit similar Home Screens. There is the one Home Screen designated for personal use, and the other one distinctly for business use. Both Home Screens are launchers from which you can launch the apps that correspond to that Home Screen.
Now I set my Home Screen this way:
ComponentName component = new ComponentName(HomeScreen1.class.getPackage().getName(), HomeScreen1.class.getName());
packageManager.setComponentEnabledSetting(component, packageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
startActivity(intent);
When I launched a personal app and then press Home, I want it to go to the personal apps Home Screen, when I am on the business Home Screen (it's just a different activity you can get to by pushing a button on the first Home Screen), if I launch a business app, I want pressing Home to bring me to this second Home Screen.
I realize that one way to do this is to just have one Home Screen activity and kind of change the setContentView()
arguments so that it visually changes, but this becomes very unmanageable. Since the user has nominated my app as a Home Screen Replacement App, even though technically only one Activity is nominated as the Home Screen, I was wondering if there was a way to, when the user presses the Home button go through some control statement and launch one of the two Home Screens?
It need not necessarily be that simple a solution, but basically I'm trying to avoid constantly overriding the setContentView()
method, if possible.
EDIT: In case it's unclear, I have HomeScreenPersonal
and HomeScreenBusiness
, currently pressing Home button always brings you to HomeScreenPersonal
. I was wondering if there was a way to easily have 2 home screens basically where the Home Screen is dependent on some high level boolean.