Harsh Vardhan Harsh Vardhan - 1 month ago 11
Android Question

Open a fragment of an activity from another activity

Hi All I want to open the "Text-To-Speech output" fragment of Settings from my application. I think first I need to open the settings activity and then its fragment. I tried setting the

ComponentName
but it was unable to locate the activity.


Should I use
FragmentManager
; I couldn't find anything specific to my needs. Can somebody give me some link which might explain it well.

Answer

You can use the following:

Intent ttsSettings = new Intent("com.android.settings.TTS_SETTINGS");
ttsSettings.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(ttsSettings);