In android development the phase comes where the app needs the specific settings to be modified manually by user. So at that time developer directs the user to open specific settings and modify them. So in this article it has been discussed on how to open specific settings and make the user change them easily.
Step 1: Create new Empty Activity android project
- While creating a new android studio project give the name of the project as “Open specific settings”.
- You may refer: Android | How to Create/Start a New Project in Android Studio?
- Select Kotlin as the language, and layout name as activity_main.xml.
Step 2 : You may change the color combination of the application
- You may change the color combination of the base theme of the application. To change it open app -> src -> main -> res -> values -> colors.xml.
- Invoke the following code in colors.xml.
- You may refer the following image to get the colors.xml file.
Step 3: Working with activity_main.xml
- Here, Buttons are used to open each of the specific settings. There are many different settings in android out of all of them seven are most commonly used. So seven buttons are added to the activity layout.
- Invoke the following code inside activity_main.xml :
Following output UI is produced :
Step 4: Working with MainActivity.kt file
- You may refer: Buttons in Kotlin to know how to handle the button clicks through setOnClickListener using Kotlin.
- In this case implicit intents are used you may refer: Android | Implicit and Explicit Intents with Examples for implicit intents.
- Invoke the following code to handle all the buttons.
Note: Make sure to import the android.provider.Settings package to import all the settings class in project:
- For more of the settings screens you may refer this official documentation.
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
- How to Add OpenCV library into Android Application using Android Studio?
- Android | Android Application File Structure
- Android | How to add Radio Buttons in an Android Application?
- Android | How to Request permissions in Android Application?
- How to open dialer in Android through Intent
- Android | How to open Camera through Intent and display captured image
- Components of an Android Application
- The Application Manifest File | Android
- How to add a Pie Chart into an Android Application
- How to add Toggle Button in an Android Application
- How to Add Widget of an Android Application?
- Designing the Landscape and Portrait Mode of Application in Android
- Processes and Application Lifecycle in Android
- How to install Android Applications in Mobile Phone without USB Cables using Android Studio
- How to implement Swipe Down to Refresh in Android using Android Studio
- Android | AdMob Banner Ads for Android Studio
- Android | AdMob Interstitial Ads for Android Studio
- Android | How to Create/Start a New Project in Android Studio?
- Android | Running your first Android app
- Difference between Android 1.1 and Android 4.0.1
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.