Issue
I want to open bluetooth settings on button click like this see image
HomeActivity.java
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
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.bluetoothSettings");
intent.setComponent(cn);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity( intent);
}
});
Solution
use
ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.bluetooth.BluetoothSettings");
instead of
final ComponentName cn = new ComponentName("com.android.settings",
"com.android.settings.bluetoothSettings");
to launch BluetoothSettings settings
Answered By - ρяσѕρєя K
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.