2

Problem

I have a simple Android app with 3 activities: Login, Browse_Catalog, and View_Item. On ChromeOS, I expected the Activities to stack in a single window. Instead, each Activity is appearing in its own, independently managed window on ChromeOS. Why is that happening? And how do I stop that behavior?

Request

My hope is that there is some configuration detail to keep activities stacked in a single window. I've tried looking for some flag in the Intent that launches the Activity, or some setting in the Manifest, but haven't found anything that indicates this behavior is intentional, or that there is a way to disable it.

Technical Details

ChromeOS 76.0.3809.102 (Official Build)(64-bit)
Asus Chromebox 
Android Studio 3.4.2
targetSdkVersion: 28
minSdkVersion: 25
jvmTarget: 1.8

Observations

  1. No error messages as far as I can tell. Just an awful user experience with multiple windows leading the user to think there are three separate programs running.

  2. The Activities that should be hidden on the backstack, aren't very responsive, the windowmanager allows them to be resized briefly before reasserting a z-ordering on the activities.

  3. The windowmanager does allow me to close an Activity/window from the backstack (e.g. Browse Catalog, while Viewing Item), but then backing off from the top Activity goes nowhere.

Possible Workarounds that are Unsatisfactory

I can kind-of workaround this by making the Activities launch in full-screen, but it feels like a huge kludge. It doesn't prevent users from minimizing or resizing individual windows.

Perhaps I could do this as single activity with multiple fragments, but I don't want to invest that much work, unless I absolutely have to.

Community
  • 1
  • 1
Gary Kumfert
  • 225
  • 1
  • 2
  • 11

1 Answers1

0

For posterity: My mistake was the Browse_Catalog Activity had a line in the Manifest

<activity ...
     android:launchMode="singleInstance"
    />

This creates the Activity as a single "Task", and won't launch any additional Activities into that Task. Here's a page with more details about Activities, Tasks, and BackStack

The default behavior (aka android:launchMode="standard") is what I was expecting, so removing this spurious setting solved the problem.

Gary Kumfert
  • 225
  • 1
  • 2
  • 11