Android activity recreate itself

后端 未结 13 1767
攒了一身酷
攒了一身酷 2021-02-05 07:06

My app normally works just fine, until I face a strange problem on specific device. There are 2 activities in App. After I start ActivityB inside of ActivityA, ActivityA starts

13条回答
  •  感动是毒
    2021-02-05 07:35

    Activity A uses layout R.layout.mesajlar_list

    Activity B uses layout R.layout.mesajdetaylari

    But both have the following line of code:

    kapatButton = (ImageView) findViewById(R.id.kapat_button);
    

    Which layout is R.id.kapat_button in? Using the same id in different layouts is a very risky thing to do. I can't guarantee it's causing what you're seeing, but it is the sort of thing that may cause weird behaviour.

提交回复
热议问题