我尝试再次打开应用saveinstance
仍然为空
我的代码是正确的?谢谢你的回答
public class MainActivity extends AppCompatActivity {
TextView cc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
cc=(TextView) findViewById(R.id.test);
Toast.makeText(this,"Oncreate",Toast.LENGTH_LONG).show();
if (savedInstanceState != null) {
cc.setText( "=++++++++++++++");
Toast.makeText(getApplicationContext(),"not null",Toast.LENGTH_SHORT);
}else{
Toast.makeText(getApplicationContext(),"OnCreate",Toast.LENGTH_SHORT);
cc.setText("kkkkkkkkkk");
}
}
@Override
public void onSaveInstanceState(Bundle out){
Toast.makeText(this,"onSavedInstance",Toast.LENGTH_SHORT).show();
out.putString("checking", "checking");
super.onSaveInstanceState(out);
}