Cilenco
Cilenco

Reputation: 7117

Add settings button to app info screen

Since Android N it is possible to add a settings button to the app info screen like in the picture below but I cant find any information about how to implement this?

enter image description here

I guess we only have to specify an intent filter for an Activity but which one do we have to use?

Upvotes: 4

Views: 598

Answers (2)

Anders Duus
Anders Duus

Reputation: 426

You can use this on Android 7.0 and higher, simply by add this line of code to your manifest:

<intent-filter>
  <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

Upvotes: 4

Bharat Vasoya
Bharat Vasoya

Reputation: 361

On Android 7.0 and higher, you can use this <intent-filter> on your settings activity:

<intent-filter>
  <action android:name="android.intent.action.APPLICATION_PREFERENCES" />
  <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

The Settings app should pick that up and make it available to the user via that gear icon.

Upvotes: 0

Related Questions