访问Android操作系统设置

时间:2014-01-09 10:09:37

标签: java android android-settings

如何从源代码访问Android操作系统设置? 我可以访问一些设置,例如检查Internet连接

private void checkIntenet() {
        connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);

        networkInfo = null;
        networkInfo = connectivityManager.getActiveNetworkInfo();
        if (networkInfo != null) {
            stringBuilder.append(getResources().getString(R.string.activeNetwork) + "\n");
            stringBuilder.append(getResources().getString(R.string.available) + " " + networkInfo.isAvailable() + "\n");
            stringBuilder.append(getResources().getString(R.string.connected) + " " + networkInfo.isConnected() + "\n");
            stringBuilder.append(getResources().getString(R.string.extra) + "" + networkInfo.getExtraInfo() + "\n" + "\n");
        } else {
            Toast.makeText(this, "networkInfo is null", Toast.LENGTH_SHORT).show();
        }
    }

但我无法访问Android操作系统设置

2 个答案:

答案 0 :(得分:0)

试试这个;

startActivity(new Intent(android.provider.Settings.ACTION_SETTINGS));

答案 1 :(得分:0)