In android development, the phase comes where the app needs specific settings to be modified manually by the user. So at that time developer directs the user to open specific settings and modify them. So in this article, it has been discussed how to open specific settings and make the user change them easily.
Step 1: Create a 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 to the following image to get the colors.xml file.
Step 3: Working with the 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 the seven that are most commonly used. So seven buttons are added to the activity layout.
- Invoke the following code inside activity_main.xml:
The following output UI is produced:
Step 4: Working with the 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 the project:
Output: Run on Emulator
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?
- Android | How to open Camera through Intent and display captured image
- How to open dialer in Android through Intent?
- 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 find and open the Hidden files in a Directory using Java
- 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
- Difference between Android 1.1 and Android 2.3.4
Improved By : adityamshidlyali