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?
Asked
Active
Viewed 583 times
3
-
how??can you write that code here?? – Nitish Patel Jan 08 '14 at 11:04
-
ok I will write now for you – Satyaki Mukherjee Jan 08 '14 at 11:05
-
check out my answer....... but it will work for 2.3 above....... if needs anything then please ask me – Satyaki Mukherjee Jan 08 '14 at 11:07
-
After your test please accept and +1 , it will boost me up – Satyaki Mukherjee Jan 08 '14 at 11:09
-
@SatyakiMukherjee thanx for yr answer..but it seems that your code is check mobile data(GPRS) coz I have used this code for it. – Nitish Patel Jan 08 '14 at 11:10
-
so what do you want? can you elaborate ? – Satyaki Mukherjee Jan 08 '14 at 11:12
-
I want to check red mark checkbox and for your information you can see it in settings->date and time of device.How can I check this checkbox? – Nitish Patel Jan 08 '14 at 11:13
-
let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/44768/discussion-between-nitish-patel-and-satyaki-mukherjee) – Nitish Patel Jan 08 '14 at 11:14
-
ok let's try to do this....... – Satyaki Mukherjee Jan 08 '14 at 11:16
-
You can not do this in such a way. I have develop a code, which will auto redirect to your given screen. Otherwise I think no feasible solution found. – Satyaki Mukherjee Jan 08 '14 at 11:49
-
will you please write down that code.. – Nitish Patel Jan 08 '14 at 12:00
-
please see my edited answer, it will help you. – Satyaki Mukherjee Jan 08 '14 at 12:05
3 Answers
2
android.provider.Settings.System.getInt(getContentResolver(), android.provider.Settings.Global.AUTO_TIME)
0 - not checked 1 - checked
Answer Credits Matthias Robbers

raja sid
- 83
- 6
0
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.

cafebabe1991
- 4,928
- 2
- 34
- 42

Satyaki Mukherjee
- 2,857
- 1
- 22
- 26
0
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/