HOW to import text from web site in android application
22:22 18 Apr 2014

I am trying to import text from a web page hosted on the server I have the java file as below

public class News extends Activity
{
    TextView txtview;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.txt_news);
        txtview =(TextView) findViewById(R.id.textView1); 

        try
        {
            HttpClient htc=new DefaultHttpClient();
            HttpPost htp=new HttpPost("http://www.aaaa.com/a.php");

            HttpResponse res=htc.execute(htp);
            HttpEntity ent=res.getEntity();
                    InputStream web=ent.getContent();
            try
            {
                BufferedReader reader=new BufferedReader(new InputStreamReader(web,"iso-8895-1"),8);
                txtview.setText(reader.readLine());
                web.close();

            }
            catch(Exception e)
            {
                Log.e("log_tag","Error"+e.toString());

            }



        } catch(Exception e)
        {
            Log.e("log_tag","Error"+e.toString());

        }
            finally
            {

            }


}
}

and the layout xml coded like :



    

    

In manifest i have also included the internet connection permission syntax but i dont get any text from hosted file a.php

the code in a.php:


please help to resolve the problem the text view is not showing the $t variable content hello buddy.how to do that.... screen of layout.xml appears but there is no text in textview.

java php android