每次 Settings.System 出现在它刚才所说的代码中时,我都会收到错误System cannot be resolved
消息not a field
。我怎样才能解决这个问题?
public class InternetSpeedup extends Activity {
ImageView toggle;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_internet_speedup);
toggle = (ImageView) findViewById(R.id.imageView1);
new CountDownTimer(31000, 1000) {
public void onTick(long millisUntilFinished) {
//toggle.setText("You have "+ millisUntilFinished / 1000 + " seconds left");
}
public void onFinish() {
// read the airplane mode setting
boolean isEnabled = Settings.System.getInt(
getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, 0) == 1;
// toggle airplane mode
Settings.System.putInt(
getContentResolver(),
Settings.System.AIRPLANE_MODE_ON, isEnabled ? 0 : 1);
// Post an intent to reload
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", !isEnabled);
sendBroadcast(intent);
}
};
}
}