How can I overlay a 'back' and 'next' button on a “ pick wifi network ” window?

后端 未结 2 1885
陌清茗
陌清茗 2021-01-18 02:32

Google play does this when you try to use it and happen to not be connected to a wifi network.

photo of what I\'m trying to do:

2条回答
  •  一整个雨季
    2021-01-18 03:00

    This is just an improvement of UncleKing's answer.

    Since you ask specifically for

    How can I get buttons overlayed on to what you see with a WifiManager.ACTION_PICK_WIFI_NETWORK?

    There is no need for the extras only_access_points and wifi_enable_next_on_connect. You only need the extra_prefs_show_button_bar extra. The overlay buttons will appear just by using this last extra.

    You can try this using ADB if you want:

    am start -a android.net.wifi.PICK_WIFI_NETWORK --ez extra_prefs_show_button_bar True
    

    So the reduced code would be:

    Intent intent = new Intent(WifiManager.ACTION_PICK_WIFI_NETWORK);       
    intent.putExtra("extra_prefs_show_button_bar", true);
    startActivityForResult(intent, 1);
    

    Tried it on Android 4.1, 4.4 and 5.1.

提交回复
热议问题