androidandroid-intentandroid-settings

How to display only specific Settings fragment from android inbuilt Settings app


I want to show only wi-fi settings fragment from settings. I have achieved this by using following code:

        Intent i = new Intent(Settings.ACTION_SETTINGS);
        i.putExtra(":android:show_fragment", "com.android.settings.wifi.WifiSettings");
        i.putExtra(":android:no_headers", true);
        startActivity(i);

Now I want to show only date & time fragment from settings so I changed my code to:

        Intent i = new Intent(Settings.ACTION_SETTINGS);
        i.putExtra(":android:show_fragment","com.android.settings.ACTION_DATE_SETTINGS");
        i.putExtra(":android:no_headers", true); 
        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(i);

unfortunately it's not working.How can I display only specific Settings fragment from android inbuilt Settings app like this


Solution

  • I want to show only wi-fi settings fragment from settings. I have achieved this by using following code:

    I would recommend that you use ACTION_WIFI_SETTINGS and get rid of the undocumented extras.

    Now I want to show only date & time fragment from settings so I changed my code... unfortunately it's not working.

    The right solution is to use ACTION_DATE_SETTINGS and get rid of the undocumented extras. Beyond that, com.android.settings.ACTION_DATE_SETTINGS is not the name of a fragment.