How to get reference to native android activity? #17350
Unanswered
MaxwellDAssistek
asked this question in
Q&A
Replies: 1 comment 5 replies
-
From what I know, that's a typical recommendation for native android development. There are no android APIs to get current activity. Avalonia doesn't add one either. Keep in mind, that activity can be re-created in the same process multiple times. If android OS suspends app and restores it. Normally, it would execute OnCreate method each time. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I need to get a reference to the native android that Avalonia is running in to do some native android manipulation. Is there any way to get at it through Avalonia without resorting to just storing a reference in a random static variable.
Poking around in the debugger shows that
Application.Current.ApplicationLifetime.Activity
exists but it is in theAvalonia.Android.SingleViewLifetime
class which is marked internal. I guess I could use reflection to get at it, but that feels dirty.Thank you!
Beta Was this translation helpful? Give feedback.
All reactions