This is part 1 of a 2 part series: part 2
In this part, I will show you a cool feature of Xamarin.Android that you probably don’t know about: the ability to embed .java files directly in your C# project and then execute that Java code.
Have you ever Google’d for how to do something in Android and found some Java code?
What are the options for using that Java code in your Xamarin app?
If it’s a large library, like an SDK, then you’ll want to get the .jar and create an Android Binding Library. That’s the topic of Part 2 in this series and we won’t talk about that further today.
If it’s a small bit of code, then your options are: 1. Convert the Java code to C# manually, 2. Include the Java code in your app and call it (the topic of this post)
I first learned about this feature by stumbling across a Xamarin sample.
If you’re not familiar with the Xamarin samples library, I recommend that you have a look through http://developer.xamarin.com/samples.
Xamarin have a comprehensive library of samples for all areas of the platform. They’re really good at keeping them up to date as new versions of Xamarin are released.
It’s a great way to discover features that might come in handy one day.