2014-10-20 51 views
-1

我在我的android应用程序中有一个TextView。现在我需要从ashx页面获得一个值。当我在浏览器中打开该ashx页面时,我可以看到它只显示一个值。我需要在我的TextView中显示这个值。如何从ashx页面获取android中的字符串值?

请帮我...

+0

你能告诉我ashx的网页...与网址.. ..? – 2014-10-20 07:03:53

+0

http://173.45.66.154/VSServices/Export.ashx?f=GetClientBalance&pin=rsbtest&includeCurrency=true – Shoaib 2014-10-20 07:04:16

+0

@AngadTiwari:这是 – Shoaib 2014-10-20 07:05:33

回答

0

获取Internet权限....和公正运行这段代码...

 try 
     { 
      HttpClient client=new DefaultHttpClient(); 
      HttpGet request=new HttpGet("http://173.45.66.154/VSServices/Export.ashx?f=GetClientBalance&pin=rsbtest&includeCurrency=true"); 
      HttpResponse response=client.execute(request); 

      HttpEntity entity=response.getEntity(); 
      String resonseText=EntityUtils.toString(entity); 
      textviewObject.setText(resonseText); 

      entity.consumeContent(); 
     } 
     catch(Exception e) 
     { 
      e.getStackTrace(); 
      Toast.makeText(MainActivity.this, e.toString() , 0).show(); 
     } 
+0

的页面让我知道......它是否有效? – 2014-10-20 07:26:57

+0

我得到一个错误:android.os.NetworkOnMainThreadException – Shoaib 2014-10-20 07:33:21

+0

:我已经采取了互联网许可,并尝试与代码你给..但获取错误:android.os.NetworkOnMainThreadException – Shoaib 2014-10-20 07:43:17

相关问题