修改 /etc/UPower/UPower.conf
IgnoreLid=true
/etc/systemd/logind.conf
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
重啟
修改 /etc/UPower/UPower.conf
IgnoreLid=true
/etc/systemd/logind.conf
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
1 2 3 4 5 6 7 8 9 10 | @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { // Respond to the action bar's Up/Home button case android.R.id.home: super .onBackPressed(); return true ; } return super .onOptionsItemSelected(item); } |
1 2 3 4 | //取得SharedPreference設定("Preference"為設定檔的名稱) SharedPreferences settings = getSharedPreferences( "Preference" , 0 ); //置入name屬性的字串 settings.edit().putString( "name" , nameEditText.getText().toString()).commit(); |
1 2 3 4 | //取得SharedPreference設定("Preference"為設定檔的名稱) SharedPreferences settings = getSharedPreferences( "Preference" , 0 ); //取出name屬性的字串 String name = settings.getString( "name" , "" ); |