zoukankan      html  css  js  c++  java
  • Android开发 如何快速调用系统设置

    在之前,一般我们是通过下面的方式,来调用系统设置(时间设置、网络设置等等):

    1 Intent intent = new Intent();
    2 ComponentName cn = new ComponentName("com.android.settings",
    3         "com.android.settings.WirelessSettings");
    4 intent.setComponent(cn);
    5 intent.setAction("android.intent.action.VIEW");
    6 startActivity(intent);

    但是经测试,在SDK4.0版本上使用会抛出异常,那么我们可以用下面的方式来调用系统设置界面:

      Intent intent = new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS);
      startActivity(intent);

    使用下面的字段,可以在你的软件中打开相应的系统设置界面:

    android.provider.Settings.ACTION_SETTINGS                 //系统设置

    android.provider.Settings.ACTION_APN_SETTINGS         //接入点设置

    android.provider.Settings.ACTION_SOUND_SETTINGS             //声音设置

    android.provider.Settings.ACTION_WIRELESS_SETTINGS         //网络设置

    android.provider.Settings.ACTION_SECURITY_SETTINGS          //安全设置

    android.provider.Settings.ACTION_WIFI_SETTINGS                 //WiFi设置

    android.provider.Settings.ACTION_BLUETOOTH_SETTINGS      //蓝牙设置

    android.provider.Settings.ACTION_DATE_SETTINGS                //日期和时间设置

    android.provider.Settings.ACTION_BLUETOOTH_SETTINGS      //蓝牙设置

    这里只列出了常用的字段,其他的可以到官方源码中查找,是不是很简单?!

  • 相关阅读:
    VS2010 自动跳过代码现象
    Reverse Linked List II 【纠结逆序!!!】
    Intersection of Two Linked Lists
    Linked List Cycle II
    Remove Nth Node From End of List 【另一个技巧,指针的指针】
    Swap Nodes in Pairs
    Merge Two Sorted Lists
    Remove Duplicates from Sorted List
    Linked List Cycle
    Dungeon Game
  • 原文地址:https://www.cnblogs.com/gxchexi/p/4579642.html
Copyright © 2011-2022 走看看