I am new developer and i want a good simple and analytical example for get 
data from my website.net/ledstate.txt with AsyncTask....i try without 
asynctask and no work....this code...with permissions internet....

    

 public class GetDataWeb extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {

    try{

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_get_data_web);

    TextView t = (TextView)findViewById(R.id.netResult);

    try{

    HttpClient httpclient = new DefaultHttpClient();   

    HttpPost httppost = new HttpPost("http://www.mysite.net/LEDstate.txt";);

    HttpResponse response = httpclient.execute(httppost);

    HttpEntity entity = response.getEntity();

    InputStream webs = entity.getContent();

      try{

          BufferedReader reader = new BufferedReader(new 
InputStreamReader(webs,"iso 8859-1"),8);

          t.setText(reader.readLine());

          webs.close();

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

      }

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

thanks...

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to