#Xamarin.Android

I made a mistake / misunderstanding when writing the previous blog: Xamarin.Android vs. Native Android - How you implement Java Listener in C#, which is about how to transfer Java code to C# coding when doing Xamarin.Android project. (Means that sometimes you will have to implement some code in C# by refering to some code from native Android sample which is written in Java.)

I will keep that blog because it’s still correct but not the best practice as I can think of for now. So you can think of this as a better one.

Background

Recently I am reading a pdf which is from Microsoft official site for Xamarin.Android development. I read about the Downloadable Fonts which has more benefits than you packaged the font into the apk file.

For detail information about Downloadable Fonts, check here: Downloadable Fonts.

In the above link, you will see there is a sample from Google that demonstrate how this works.

Here is the link: android-DownloadableFonts

But I am learning Xamarin.Android so I thought maybe I can try to implement it with a Xamarin.Android version. (Usually I will use Xamarin.Forms for developing Xamarin app.)

Then the nightmare happened, I found it really hard to implement the code just by reading the Java code from Google’s sample, even C# and Java are quite similar.

The good thing is that I suddenly found that Xamarin team has done a sample for Xamarin.Android also, it’s exactly the same as Google’s sample. Which means that someone has done the same thing as I want to.

Here is the link: Xamarin.Android DownloadableFonts Sample

I checked the code and it’s quite good and elegant.

So, what you will see in this blog is that I am gonna use these 2 sample projects to get through some important points and practice that how you can do Xamarin.Android development if you need to refer to a native Android project.

Read More

It’s really important for engineers who use Xamarin to develop Android app to know how to transfer Java code to C# code.

Recently I am trying to implement something in Xamarin.Android project (Not Forms) and I encountered lots of issues.

What I can find online is mostly Android native documents from Google. And I do find one sample project from Google that is implemented in Android Studio using Java.

So what I have to do is to understand how to transfer Java code to C# code, otherwise you will find it quite difficult to use pure Xamarin.Android project.

Read More

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×