Android Configuration Parameters

4

I would like to know if you have any way to get the values directly from the android settings example I want to know if "Unknown Fonts" is enabled, "Developer Mode" is enabled, "Language", "Brightness level" ... ..

    
asked by anonymous 07.10.2015 / 20:59

2 answers

2

This information can be obtained using the Settings.System

Some of the constants are obsolete so, depending on the target api you want to use, consider using the Settings.Global and Settings.Secure

For example to get the default "brightness level" value use:

try {
    float curBrightnessValue = android.provider.Settings.System.getInt(
    getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS);
} catch (SettingNotFoundException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

Code Source

    
07.10.2015 / 22:44
0

You could call the Android settings at the push of a button, like this:

XML button:

<Button
        android:id="@+id/btn_config"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/btn_prox"
        android:layout_toStartOf="@+id/btn_prox"
        android:text="@string/btn_config"
        style="?android:attr/buttonBarButtonStyle"
        android:onClick="config" />

See above that the android:onClick attribute will call the config method on its MainActivity , as seen below:

package com.newthread;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.provider.Settings;
import android.view.View;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
    }

    public void config(View view) {

        Intent intent = new Intent(Settings.ACTION_SETTINGS);
        startActivity(intent);
    }
}

Settings are called through the Intent and the Settings.ACTION_SETTINGS class.

See the Android Developers documentation: link

    
23.05.2016 / 02:37