Reputation: 2477
When I start Wifi setting page from android's setting page, there is a back button in the top action bar. But there is not when I start Wifi setting from my own app.
The code I am using is:
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
startActivity(intent);
I know that the wifi setting activity and my activity are already in the same back stack. Is there any way to show the back button in the action bar?
Upvotes: 2
Views: 1019
Reputation: 423
Try adding
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
or try
Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.wifi.WifiSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity( intent);
Upvotes: 1
Reputation: 54214
As far as I'm aware, there's no way to do what you want. However, I think that even if there were, it is unlikely that you would actually want to do it.
The "back" button in the action bar is actually an Up button. Clicking it wouldn't take the user back to your app; it would take the user up one level within the device settings.
https://developer.android.com/design/patterns/navigation.html
Upvotes: 1