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 button click? i want to achieve this using onClick method not id method. below is my code
<RadioButton
android:onClick="togglewifi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:checked="true"
android:text="Toggle Wifi" />
public void togglewifi(View view) {
Intent intent = new Intent( );
startActivity(intent);
}
This code works for 4.2.2
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
final ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.TetherSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity( intent);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With