onCreate函数不同造成的,都用第二个就好了
public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState){
}
public void onCreate(Bundle savedInstanceState){
}
PersistableBundle :这就是5.0给我们提供的新的方法,要用它,先要在配置文件中为我们的Activity设置一个属性:
android:persistableMode="persistAcrossReboots"
然后我们的Activity就拥有了持久化的能力了,一般我们会搭配另外两个方法来使用:
public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState)
public void onRestoreInstanceState(Bundle savedInstanceState, PersistableBundle persistentState)