App Acts Differently On Surface Duo After Reopening

Nathan Sokalski 4,116 Reputation points

I have a method in my app that positions a TextView by setting the TranslationX & TranslationY properties. When I start debugging the app by connecting it to the device, everything works as expected, even when rotating or moving to a different Activity in the app. However, once I close the app and then reopen it (using the device, not the debugger), the method that calculates the TranslationX & TranslationY values does not work. The elements on the page do not change at all, it is the same device (which means the screen is the same size), and there are no state values being loaded to be used in calculating the values (the parameters are hardcoded). Why does the app act differently when being opened the second time? My only guess has something to do with something like one of the layout passes not finishing in time for me to use certain values (the width of the TextView, for example). However, because it works when using the debugger, I am not sure how to attempt to determine this (or what to do to figure out the problem). Any ideas? Thanks.

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,148 questions
{count} votes