There is activity, from it you need to go to fragment. This line does not want to work:
intent = new Intent(MainMenu.this, Service.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); There is activity, from it you need to go to fragment. This line does not want to work:
intent = new Intent(MainMenu.this, Service.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); Intent to open the Activity used, to go to the fragment you must use the FragmentManager .
FragmentManager fragmentManager = getFragmentManager() FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); ExampleFragment fragment = new ExampleFragment(); fragmentTransaction.add(R.id.fragment_container, fragment); fragmentTransaction.commit(); Read off. documentation
Source: https://ru.stackoverflow.com/questions/282927/
All Articles
MainMenu- what is it?Activity,Fragment? AndService? - falstafServiceclass, which in fact is not a service at all, but a fragment (and even the name makes confusion with the class of the same name from the SDK) is generally beyond good and evil. Use appropriate suffixes, at least. - falstaf