Porting my C# NET App to Java?

Discussion in 'Android Hacks and Help' started by CrimsonGT, Jun 18, 2011.

  1. CrimsonGT
    Offline

    CrimsonGT New Member

    Joined:
    Feb 24, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Ratings:
    +0
    I have a fairly basic application that I wrote in C# NET some time ago and would like to rewrite it for the Android platform. It just uses an API exposed by some web software, and I can access it with just a WebClient in .NET.

    Code:
                WebClient myClient = new WebClient();
    
                //Prepare a Name/Value Collection to hold the post values
                NameValueCollection form = new NameValueCollection();
                form.Add("username", "bob");
                form.Add("password", GetMD5Hash("mypass"));
                form.Add("action", "getusers");
    
                // POST data and read response
                Byte[] responseData = myClient.UploadValues("https://mysite.com/api.php", form);
                string strResponse = Encoding.ASCII.GetString(responseData);
    I found the WebKit (android.webkit | Android Developers) but just from looking that doesn't seem appropriate.

    Does anyone have any sample code of how to port this over?
     
  2. Rayzor
    Offline

    Rayzor Member

    Joined:
    Mar 20, 2011
    Messages:
    81
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    New York
    Ratings:
    +0
    Current Phone Model:
    HTC One M8
    I know there are websites that take the code and will just take the code you copy into the C# text box and then it goes through a couple phases and gives you the code in Java. Obviously, you'd want to test the code first before releasing the application, but otherwise, I'm sure someone here should be able to just translate that for you.
     
Search tags for this page

porting c# to android