Share via


How to convert android java code to xamarin c# code

Question

Friday, July 8, 2016 3:05 AM

I found many code I need on internet but almost android java code. Have any way to convert them, example: 1. Online convert android java code to xamarin C# 2. Windows Application android java code to xamarin C# 3. Or VS support them:

public static void MyMethod() { int i; ............. '#java code begin ............. (example: save something to file) '#java code end ............... load file to saved to read (and/or write and/or delete) ............... }

Many java code, I cant manual convert or wrong convert, I installed android studio but it heavy & slower then VS, and I dont know anything about java & android studio, too

All replies (4)

Friday, July 8, 2016 6:01 AM

I cannot tell you how to convert, but I can tell you, you may want to use the automatic generator that xamarin uses to create a dll form a Java library (a jar for example) and get a dll to use it with C# without caring about translating. If the library is simple enough, you may get it luckily without errors.

https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/

If you have errors, you can try these ones:

https://developer.xamarin.com/guides/android/advanced_topics/binding-a-java-library/troubleshooting-bindings/

Good luck.


Friday, July 8, 2016 3:55 PM

Thankyou! I have read it, and maybe use in future! Some days ago, I post topic but no one answear. When I wanna ask something, which topic is best to post.? Example: How to listen volume-down event key up in service? (Im building AutoTouch4D app (2D is relating image))


Thursday, November 23, 2017 9:17 AM

Try this site https://carlosag.net/tools/codetranslator/


Saturday, March 2, 2019 7:32 AM

I found a site that put some good stuff about Xamarin. And I had a lot of questions that got all my answers. Thank you for your forum