1、重写onSaveInstanceState方法
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
2、在onCreate方法中判断(Bundle savedInstanceState)对象是否为空
public void onCreate(Bundle savedInstanceState) {
//判断 savedInstanceState是不是空.
//如果不为空就取出来
super.onCreate(savedInstanceState);
}