2009-07-28 18 views

答えて

1

は私を参照してください。このWebサービスのためのAndroidのクライアントを作るために私を助けることができますここでの質問:Unresolved Host Exception Android

残りのサービスを呼び出すことは、HttpResponseを作成し、返されたxml/json/valueを処理することだけです。

+0

何かを行うだけであれば簡単です... –

5

あなたはたぶん動作するものを見つけましたが、私はこのスレッド全体でつまずきました。他の人にとっては、以下のものが役に立ちます。

MVCとAndroidでRESTアプリケーションを使用する方が好きです。サーバーを作成する -www.asp.net/mvc(良いビデオチュートリアル)

のhttp:// 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'/>"); 
    } 
} 

とSET Global.asax:

//テスト routes.MapRoute( "test"、 "{Page} .Mvc/tester"、new {controller = "Testing"、action = "GetString"、Page = defaultPage});

Andoidクライアントの開発コードexampels:

http://www.smnirven.com/?p=15

のhttp:/ /senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restful -client-AT-アンドロイド/

パブリック文字列の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) { 
     e.printStackTrace(); 
    } finally { 
    if (entity!=null) 
    try { 
     entity.consumeContent(); 
    } catch (IOException e) {} 
    } 
    return result; 

}アンドロイドのためのRESTの設計について

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

ヒント:

のhttp:/ /www.youtube.com/watch?v=xHXn3Kg2IQE

のhttp:/ /www.infoq.com/articles/rest-導入

一般のAndroidヘルプ:

のhttp:/ /mobile.tutsplus.com/tutorials/android/introduction-to-android-development/

ht t p:/ /www.youtube.com/watch?v=lqopIf-bA54 &フィーチャー=関連

関連する問題