user2200319 user2200319 - 4 months ago 16
Android Question

Android Xamarin App content

I am developing some small android app using visual studio and xamarin on C#.
Application is simple for beggining, it has 3 menu items (profile, news feed, images), and i want to switch app content on menu item click.
2 approaches that i tried was creating 3 differen layouts for each of menu items, than switching them with SetContentView, and 2nd approact was creating 3 Activities each using SetContentView for every layout.

As a new developer on xamarain and generaly for android devices i am not sure about is any of these 2 methods good way to do this.

Can anyone recomend best approach for this?
Thank you


You should either create separate activities or fragments for each screen you want to display. If you use activities, then you should start them with an Intent. For fragments, you should use the FragmentManager to switch fragments. There are several tutorials online about these techniques. Most of them are in Java, but you should be able to translate fairly easy.