我试图测试手机是否支持蓝牙,WiFi,adb,密码和日志。我在使用cr
方法时遇到错误,我认为它与@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mListView = (ListView) findViewById(R.id.quotes_list);
mListView.setAdapter(new QuoteAdapter(this));
//determine if phone uses lock pattern
ContentResolver cr = getBaseContext().getContentResolver();
int lockPatternEnable;
lockPatternEnable = Settings.Secure.getInt(cr, Settings.Secure.LOCK_PATTERN_ENABLED, 0);
if (lockPatternEnable==0)
{
//lock pattern enabled
lockPatternEnableBool = true;
}
if (lockPatternEnable==1)
{
//lock pattern disabled
lockPatternEnableBool = false;
}
//determine if adb is enabled
adb=Settings.Global.getInt(cr, Settings.Global.ADB_ENABLED, 0);
//determine if bluetooth is enabled
bluetooth=Settings.Global.getInt(cr, Settings.Global.BLUETOOTH_ON, 0);
//determine if wifi is enabled
wifi=Settings.Global.getInt(cr, Settings.Global.WIFI_ON, 0);
}// end of onCreate method
变量有关。我对这种类型的Android编程很新。
int