TpoM6oH
TpoM6oH

Reputation: 8575

Can I somehow use C# code or C# library in java android project?

I have some useful code written in C# and I want to use it in my android app. Can I use it directly, or it is nesessary to rewrite it on Java?

Upvotes: 7

Views: 2892

Answers (6)

paulkayuk
paulkayuk

Reputation: 1052

Depending on how many lines of code you are talking about, I would start with one of the size limited demo versions of the several 'csharp to java' code converters available. Google 'csharp to java'. You won't necessarily get perfect, runnable, java code but it will break the back of the conversion exercise for you.

Upvotes: 1

Austin Henley
Austin Henley

Reputation: 4633

If you are looking to mix C# and Java, then it will probably be more trouble than it is worth. However using Mono for Android and reading this similar question you can find the Droid you are looking for.

Upvotes: 1

twaldron
twaldron

Reputation: 2752

You will need to rewrite it. Or Run your C# code as a web service (WCF or Web API) and have your java application talk to the web service

Upvotes: 9

toadzky
toadzky

Reputation: 3846

If you are looking to do it for free, you probably have to just rewrite it in Java.

Upvotes: 4

Eng.Fouad
Eng.Fouad

Reputation: 117569

You are looking for Mono for Android~

enter image description here

Upvotes: 1

Dave Zych
Dave Zych

Reputation: 21887

There's a project called Mono for Android, and it gives you the ability to write android apps in C#:

http://xamarin.com/monoforandroid

Upvotes: 5

Related Questions