MilanG
MilanG

Reputation: 2604

Why CrossCurrentActivity.Current.Activity always gives MainActivity for any other Page in Xamarin.Forms?

I have installed the CurrentActivityPlugin in my Xamarin.Form's Android project to gain access of the top current activity.

I have DashboardPage.xaml & from this, I am navigating to another page MyProfilePage.xaml. At this level, If I try to get the current activity using CrossCurrentActivity.Current.Activity, it still gives me MainActivity only. Is there any way to know which Activity is associated with MyProfilePage.xaml?

Even, on Android's PageRenderer, it gives me MainActivity as Context, regardless of any page I navigate through.

Is this how Xamarin.Forms behaves with Page's underlying activity?

Please refer to the Android's PageRenderer screenshot.

enter image description here

Upvotes: 0

Views: 873

Answers (1)

Bruno Caceiro
Bruno Caceiro

Reputation: 7199

This is how Xamarin works. All the navigations are done within a single Activity, MainActivity.

Upvotes: 1

Related Questions