Android, How to call onCreate() explicitly from other method?

前端 未结 2 912
醉梦人生
醉梦人生 2021-02-20 15:16

I want to call onCreate(Bundle cicici); from other method then i am getting \"NullPointerException\", so please guide me how can i call the onCreate() from another method().

2条回答
  •  旧巷少年郎
    2021-02-20 15:30

    you should create the bundle again. savedInstanceState is local to onCreate method. try

    Bundle tempBundle = new Bundle();
    onCreate(tempBundle);
    

    It should work.

提交回复
热议问题