2014-01-08 14 views

回答

0

試試這個:

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

這是不可能直接從您的代碼啓用它。此代碼將幫助您自動進入該屏幕。然後,您可以選中或取消選中該選項,然後返回到您的屏幕。

+1

okies..thanx ... –

+0

這是個好問題,因爲這個原因,我給了+1 –

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; 
     } 
    } 

這個問題是相似的: how to turn internet connection (GPRS/EDGE/3G) on/off

看一看在回答中提到的項目:)http://code.google.com/p/apndroid/

1

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

0 - 未選中 1 - 檢查

答覆積分Matthias Robbers

相關問題