how to open configure portable Wi-Fi hotspot setting by onclick?

前端 未结 4 882
时光取名叫无心
时光取名叫无心 2020-12-19 16:51

how to open the following directory:settings/wireless and networks/Tethering and portable hotspot/portable Wi-Fi hotspot settings/configure portable Wi-Fi hotspot/ on butto

4条回答
  •  一生所求
    2020-12-19 17:03

    Activate Tethering in Java:

    private void activeTethering(){
        Intent tetherSettings = new Intent();
        tetherSettings.setClassName("com.android.settings", "com.android.settings.TetherSettings");
    
        startActivity(tetherSettings);
    }
    

    and in Kotlin:

    private fun activeTethering(){
        val tetherSettings = new Intent().apply {
            setClassName("com.android.settings", "com.android.settings.TetherSettings")
        }
    
        startActivity(tetherSettings);
    }
    

提交回复
热议问题