Sanat Pandey
Sanat Pandey

Reputation: 4103

How to open Settings of Android Phone on a button click in our Android App

I have a problem that I want to open Phone's Setting Screen on a Alert Dialog Ok button click. Means In my App I have a Dialog in which there are two buttons Ok and Cancel, I want to open Phone's Setting Screen on Ok Button Click, I don't know how to do that? please suggest me the right result.

Thanks in advance.

Upvotes: 28

Views: 81122

Answers (3)

H3nry T33
H3nry T33

Reputation: 356

just sharing for Kotlin sample codes:-

val dialogIntent = Intent(android.provider.Settings.ACTION_SETTINGS)
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(dialogIntent)

Upvotes: 3

ud_an
ud_an

Reputation: 4921

Intent dialogIntent = new Intent(android.provider.Settings.ACTION_SETTINGS);
dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(dialogIntent);

Upvotes: 17

Optimus
Optimus

Reputation: 2776

this should do it

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);

starts settings activity for result

Upvotes: 58

Related Questions