【发布时间】:2011-06-18 19:43:56
【问题描述】:
我前段时间用 C# NET 编写了一个相当基本的应用程序,我想为 Android 平台重写它。它只是使用了一些 Web 软件公开的 API,我可以通过 .NET 中的 WebClient 访问它。
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);
我找到了 WebKit (android.webkit | Android Developers),但只是快速浏览了一下,这似乎并不合适。
有没有人有任何如何移植的示例代码?
【问题讨论】: