I'm developing locker application. I created service and receiver to hide default android locker. But for few days I have problem with settings activity. I'm looking for a solution, how to make two activites as launchers. I want to make something like that: Locker activity is only launched when phone is locked. And Settings activity only when I press app icon in menu. Is it possible to programme? Thanks for help.
Android: Two actvities as launchers
144 Views Asked by Forin At
2
There are 2 best solutions below
0
On
You can use just one activity as launcher and use Fragments to load what you want. Something like this:
public class LauncherActivity extends FragmentActivity {
super.onCreate(savedInstanceState);
Fragment fragment;
if (isLocked()) {
fragment = new LockerFragment();
}
else {
fragment = new SettingsFragmentFragment();
}
getFragmentManager().beginTransaction().add(R.id.container_id,fragment).commit();
}
You can try to launch the same activity but changing the content view (into onCreate) for each situation. Something like: