Hey Guys,
i am from austria
i am developing android a few days now and startet to write an
application that gets a file from a server to display the content.
I have this code here
try {
super.onCreate(icicle);
setContentView(R.layout.main);
EditText myEditText =
(EditText)findViewById(R.id.myEditText);
URL url = new URL("http://www.google.at/");
HttpURLConnection http = (HttpURLConnection)
url.openConnection();
http.connect();
BufferedReader rd = new BufferedReader(new
InputStreamReader(http.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = "";
while ((line = rd.readLine()) != null) {
sb.append(line + '\n');
}
String text = sb.toString();
text = text.substring(1, 5);
myEditText.setText(text);
} catch (IOException ex) {
Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null,
ex);
..........
The strange thing is that nothing is shown in the TextField. If I test
the code in a standard java project the printing of the data (with
println) works correctly in the console. But when i run it on the
android vmachine nothing is shown. I got no more ideas left to proof
the code. Anyone has some advices for a newcomer?
Kindly Regards from austria ;) and happy developing
--
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