How to check Use network-provided values checkbox programatically in android

639 Views Asked by At

it is possible to check use network provided values chekbox pro-grammatically?I want to check that checkbox using code.How can I do it?

I want to check marked checkbox using programme

3

There are 3 best solutions below

0
Satyaki Mukherjee On BEST ANSWER

Try this:

YourActivity.this.startActivity(new Intent(Settings.ACTION_DATE_SETTINGS));

It is not possible to enable it directly from your code. This code will help you to automatically go to that screen.You can then check or uncheck it and then return back to the your screen.

0
learner On
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;
        }
    }

This question is similar to: how to turn internet connection (GPRS/EDGE/3G) on/off

Have a look at the project mentioned in the answer:http://code.google.com/p/apndroid/

0
raja sid On

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

0 - not checked 1 - checked

Answer Credits Matthias Robbers