Widespread Augmented Reality

Widespread Augmented Reality
Click on the image to get the Android Augmented Reality Heads up Display

Wednesday, July 12, 2017

Android Fragment Not Replacing Main Activity on Marshmallow

I am writing a calendar app that will listen for clicks on dates and drive the remainder of the app's functions by date and user.

The reason I am posting this is that my fragments replaced the main activity okay on a Lollipop device, but not on Marshmallow

After many hours of frustration, I happened to tilt the Marshmallow phone just enough to have the external light source reveal that the fragment was indeed present on the main activity, but BEHIND IT. This was not readily detected because the backgrounds are the same color and size while the main activity layout was 100% opaque. It was my elevation shadow that showed another layer beneath the main activity

Shazam!!! This fixed that problem:

  • When I build the fragment, I also specify calendar.setVisibility(View.GONE); , where calendar is the CalendarView in the XML layout.
  • This may not be proper form, but I don't care as I must push on and build the server application to the mobile. Meanwhile, here are some screen shots of the actual source code that I built and compiled directly on a Samsung Tablet with AIDE.

    Aha...the all important build.gradle file

    No comments:

    Post a Comment