如何在android中以编程方式选中“使用网络提供的值”复选框

如何在android中以编程方式选中“使用网络提供的值”复选框,android,systemtime,Android,Systemtime,可以按语法检查使用网络提供的值chekbox pro吗?我想使用代码检查该复选框。我该怎么做 试试这个: YourActivity.this.startActivity(new Intent(Settings.ACTION_DATE_SETTINGS)); 不可能直接从代码中启用它。此代码将帮助您自动转到该屏幕。然后您可以选中或取消选中该代码,然后返回到您的屏幕。公共类ConnectionDetector{ public class ConnectionDetector {

可以按语法检查使用网络提供的值chekbox pro吗?我想使用代码检查该复选框。我该怎么做

试试这个:

YourActivity.this.startActivity(new Intent(Settings.ACTION_DATE_SETTINGS));
不可能直接从代码中启用它。此代码将帮助您自动转到该屏幕。然后您可以选中或取消选中该代码,然后返回到您的屏幕。

公共类ConnectionDetector{
public class ConnectionDetector {

        private Context _context;

        public ConnectionDetector(Context context){
            this._context = context;
        }

        /**
         * Checking for all possible internet providers
         * **/
        public boolean isConnectingToInternet(){
            ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE);
              if (connectivity != null)
              {
                  NetworkInfo[] info = connectivity.getAllNetworkInfo();
                  if (info != null)
                      for (int i = 0; i < info.length; i++)
                          if (info[i].getState() == NetworkInfo.State.CONNECTED)
                          {
                              return true;
                          }

              }
              return false;
        }
    }
私人语境(private Context)(私人语境);; 公共连接检测器(上下文){ 这._context=context; } /** *检查所有可能的互联网提供商 * **/ 公共布尔值未连接到Internet(){ ConnectivityManager connectivity=(ConnectivityManager)_context.getSystemService(context.connectivity_SERVICE); if(连接性!=null) { NetworkInfo[]info=connectivity.getAllNetworkInfo(); 如果(信息!=null) 对于(int i=0;i
这个问题类似于:


看看答案中提到的项目:

android.provider.Settings.System.getInt(getContentResolver(),android.provider.Settings.Global.AUTO_TIME)

0-未选中 1-已检查


回答信用卡Matthias Robbers

如何?您可以在这里编写代码?好的,我现在为您编写查看我的回答。。。。。。。但它将适用于上面的2.3。。。。。。。如果你需要什么,请在考试后问我,请接受+1,这将激励我up@SatyakiMukherjeethanx代表您的答案。但您的代码似乎是check mobile data(GPRS),因为我使用了此代码。