private int mlife = 100;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.v("r", "onCreate 界面被创建的时候调用 life= " + mlife + " theadname=" + Thread.currentThread().toString());
mPhone_et = (EditText) findViewById(R.id.phone_et);
mPhone_et.setText(String.valueOf(mlife));
}
// private btn click
public void hitClick(View view) {
mlife -= 10;
mPhone_et.setText(mlife + "");
}
// 使用默认设置
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
1.每次点击btn,mlife会减少10,且刷新mPhone_et控件值,正常.
2.但每次旋转屏幕后, mlife恢复为100, 但mPhone_et控件值没有显示为原始值100, 后续观察