I answered a question on Aug 6th, C# Rest web service and Android Client

I had some general information that I provided in the answer that I would like to retrieve.

1 Answer 1


Hi, you probably found something that works, but i stumbled accross this thread, and for others, following can be useful.

I prefer REST application using with MVC and Android. -www.asp.net/mvc (good video-tutorials)

To create a Server:

h t t p : / / omaralzabir.com/create_rest_api_using_asp_net_mvc_that_speaks_both_json_and_plain_xml/

public class TestingController : Controller {
    /// <summary>
    /// Test
    /// </summary>
    /// <returns></returns>
    public ActionResult GetString() {
        return Content("A Result <orasxml id='testid'/>");

And set Global.asax:

//Test routes.MapRoute("test", "{Page}.Mvc/tester", new { controller = "Testing", action = "GetString", Page = defaultPage });

Andoid Client development code exampels:


h t t p : / /senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful-client-at-android/

public String GetData(){

    //Note, do not use http:// in host name. I did not get localhost-adress working, but
    //hosted a page in IIS instead, and it worked.
    HttpHost target = new HttpHost("www.example,com",80);
    HttpGet get = new HttpGet("/tester");
    String result=null;
    HttpEntity entity = null;
    HttpClient client = new DefaultHttpClient();
    try {
        HttpResponse response=client.execute(target, get);
        entity = response.getEntity();
        result = EntityUtils.toString(entity);
    } catch (Exception e) {
    } finally {
    if (entity!=null)
    try {
    } catch (IOException e) {}
    return result;


    //Display on buttontext, must create buttoon with ButtonReload as id...
    final Button btn = (Button) findViewById(R.id.ButtonReload);

Tips about designing REST for Android:

h t t p : / /www.youtube.com/watch?v=xHXn3Kg2IQE

h t t p : / /www.infoq.com/articles/rest-introduction

General Android help:

h t t p : / /mobile.tutsplus.com/tutorials/android/introduction-to-android-development/

h t t p : / /www.youtube.com/watch?v=lqopIf-bA54&feature=related

  • Any chance you feel that the question should not have been deleted? (Like referring to User systematically deleting and re-posting questions, or Does systematic self-deleting need to be prevented?)
    – Arjan
    Mar 4, 2011 at 11:41
  • 1
    @Arjan based on Jeff's new measure, it is fair game for undeleting, I think Mar 4, 2011 at 11:43
  • Being <10k, I cannot see the deleted question. Just trying to make sure the user is not doing this for each question. The answer above seems a bit too long to be deleted with just one click of the question asker. Maybe you can flag the question to have the moderators see if this is standard behaviour for this user?
    – Arjan
    Mar 4, 2011 at 11:47
  • @Arjan - Per G is the user who answered. 2 upvotes. The questioner was a joker whose account is no longer (gray user name) Mar 4, 2011 at 11:49
  • Ok, good. I use this answer for refference, I have not porgrammed android for a while, but will be sooner or later. I could have this info somewhere else, but others might find it useful aswell.
    – Per G
    Mar 31, 2011 at 8:27
  • @Per G // FYI the question has been undeleted a while ago Mar 31, 2011 at 8:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .