About the behavior of finish() on Android O Preview 4

Asked 2 years ago, Updated 2 years ago, 37 views

When I try to do certain things with Android Preview 4, I see a different behavior than I expected.


 When creating an application with a fixed vertical orientation, but performing a screen transition with the terminal facing sideways
 The app appears horizontally for a moment and then returns to vertical.


From the comparison between the source where the event occurs (see below) and the source where it does not occur. I think one of the reasons is that I have run finish() twice.
Even if the source of the event occurs, the app does not appear horizontally until Android 7.
It was fixed in vertical direction.

In the next version (Android 8), will finish() behave differently than Android 7 or lower?

Also, to avoid horizontal display in the next version,
Could you tell me how to rewrite the source?

The following is information about what you think is related to the occurrence of an event.

·Development environment
 Android Studio: 1.3  compileSdkVersion:10
 buildToolsVersion:23.0.0
 minSdkVersion.apiLevel:10
 targetSdkVersion.apiLevel:10

·Configuration file AndroidManifest.xml (excerpt)

<activity
  (omitted)
  android:screenOrientation="portrait"
  (omitted)
/activity>

·Source where the event occurs (excerpt)

finish();
Intent = new Intent (transition source screen .this, transition destination screen .class); // Both transition source screen and transition destination screen inherit FragmentActivity
getApplication().setIntent(intent);
startActivity (intent);
overridePendingTransition(R.anim.in_right, R.anim.out_left);
finish(); // I've done it twice

·Source where events do not occur (excerpt)

Do not
//finish()
Intent = new Intent (transition source screen .this, transition destination screen .class); // Both transition source screen and transition destination screen inherit FragmentActivity
getApplication().setIntent(intent);
startActivity (intent);
overridePendingTransition(R.anim.in_down, R.anim.out_no_move); // Animation settings are different from the source from which the event occurs
finish();

android

2022-09-30 16:14

1 Answers

(From the comments section)

It is a known bug that has been issued on AndroidIssueTracker, and it is currently being fixed.
https://issuetracker.google.com/issues/63242891
https://issuetracker.google.com/issues/63720454

In the next version (Android 8), will finish() behave differently than Android 7 or lower?

The behavior of finish() is not mentioned, but at least the behavior described in is not a specification but a bug. When AndroidO was released, it was renovated (believe me)

Also, to avoid horizontal display in the next version,
Could you tell me how to rewrite the source?

If you apply symptomatic therapy at this time, there may be side effects when Android O is released.
I think it would be better to watch the above issues.


2022-09-30 16:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.