Open Specific Settings Using Android Application
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
My Personal Notes arrow_drop_up
Please Login to comment...