Search code examples
androidashx

How to get a string value in android from ashx page?


I have a TextView in my android appliation. Now I need to get a value from an ashx page. When I open that ashx page in browser, I can see that it is showing only a single value. I need to show that value in my TextView.

Please help me out...


Solution

  • get internet permission....and just run this code...

            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();
            }