On Screen Orientation savedInstanceState restores previous View

156
February 20, 2019, at 07:50 AM

I've built my first app has lot in it tested each function as I went along, it all works apart from one issue

In my MainActivity I have the below which I understand to save or recover the View

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

and in the MainActivity I call another activity LoginActivity via an Intent where I also have

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

When I return from the LoginActivity via a

finish();

If 1 orientate the Screen it goes to my LoginActivity view, not the Mainactivity View in the new Orientation.

I also have similar with an Intent that calls a Recyclerview, but that doesnt have this issue, its Rotates the view no issues. Only difference I can see is

  • I return from the Loginactivity with Finish();
  • I return from the Recycler with the Back Button.

What would cause the LoginActivity view to be shown instead on the Mainactivity view when I change Orientation?

I feel it's that the Saved state hasn't been cleaned out with Finish(); but does get removed with Back button.

but why and how do I do manage it, so on Mainactivity it displays the MainActivity view on any orientation changes

Rent Charter Buses Company
READ ALSO
how can i solve these problems?

how can i solve these problems?

how can solve this problem, when i make run for my app these problems appear

686
Android 4.4 Volley connection error to nginx

Android 4.4 Volley connection error to nginx

I'm having trouble letting android devices with an API < 21 connect to my nginx serverAll results here are from an API 19 emulated device

150
Update Android Cast Receiver Application Id Dynamically

Update Android Cast Receiver Application Id Dynamically

I have an open-source library handling media playing and I'm updating it from just using the old cast library to using the cast framework

142