android onCreate的两个方法

    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {

    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        Toast.makeText(this,"okqq",Toast.LENGTH_LONG).show()
        Log.i("xinyu","nima")
        setContentView(R.layout.welcome_activity)
        mIntent = intent
        initView()
        init()

    }

今天写代码的时候,重写了onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) 然后,onCreate 里面的东西一直都没有执行。

后来看网上,一堆说,activity 加上
最后记得在配置文件中注册当前Activity的时候加上这个属性,android:persistableMode=”persistAcrossReboots”,这样就可以给你的Activity存储一些持久化数据。

后来,我发现,加上这个东西,我的onCreate还是没有被调用。以后重写方法,认真点吧。

原文地址:https://www.cnblogs.com/caoxinyu/p/10568581.html