Tablet Screen Orientation Change - No View found for id for Fragment

前端 未结 3 587
温柔的废话
温柔的废话 2021-01-04 23:57

I have looked at questions related to my problem on SO but couldn\'t figure out what the problem is. Bear with me if this is a repost.

Here is what i am looking for:

3条回答
  •  情话喂你
    2021-01-05 00:40

    The only way I can think of you getting that error is that your old layout is used. That could be because super.onCreate(savedInstanceState);

    Instead try ignoring the saved state:

    super.onCreate(null);
    

    Edit:

    Response to @matiash comment:

    Since OP didn't provide code to re-create the problem, it's hard to test other (if any) solutions.

    However I do agree that resetting the savedInstanceState is kind of an overkill. Therefore I think OP should try it himself and see to it that he saves as many views as possible.

    The first thing that comes to mind is preventing the problematic view from being saved:

    
    

提交回复
热议问题