A typical pattern in Android/Java development is to have a nested class that access methods from the parent class:
public class MainActivity extends FragmentActivity {
// implementation
public class SectionsPagerAdapter extends FragmentPagerAdapter {
String someString = getString(R.string.thestring);
}
}
So in this case, the Context.getString() would be accessing the MainActivity context.
How would this convert to Xamarin.Android (Mono for Android)?
When trying the exact same pattern I get:
Error CS0038: Cannot access a nonstatic member of outer type
Test.MainActivity' via nested typeTest.MainActivity.SectionsPagerAdapter' (CS0038)
I could of course pass around a Context object, but that seems tedious to do.
Activityin a constructor.xamarin.androidis a synonym ofmonodroid? I can't do it because I am under 2.5k reputation. :(