Using java Syntax Highlighting
- package com.google.android.Test;
- import java.io.InputStream;
- import java.net.HttpURLConnection;
- import java.net.URL;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TextView;
- public class webCheck extends Activity
- {
- private TextView vText;
- @Override
- public void onCreate(Bundle icicle)
- {
- super.onCreate(icicle);
- setContentView(R.layout.webCheck);
- vText = (TextView) findViewById(R.id.text1);
- try{
- URL url = new URL("http://localhost/lab/get.php");
- HttpURLConnection http =(HttpURLConnection)url.openConnection();
- http.setRequestMethod("GET");
- http.connect();
- InputStream in = http.getInputStream();
- byte by[] = new byte[1024];
- in.read(by);
- String myString = new String();
- myString = in.toString();
- in.close();
- http.disconnect();
- vText.setText(myString);
- }
- catch(Exception e)
- {
- }
- }
- }
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
Whats wrong with my code ? How would u do that ?
Thanks









.
