Я использую этот код для извлечения журнала изменений из сети.
InputStream content = null;
try {
URL url = new URL("http://dreamhawk.blinkenshell.org/changelog.txt");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setRequestMethod("GET");
urlConnection.connect();
content = urlConnection.getInputStream();
BufferedReader r = new BufferedReader(new InputStreamReader(content));
StringBuilder total = new StringBuilder();
String line;
String NL = System.getProperty("line.separator");
try {
while ((line = r.readLine()) != null) {
total.append(line + NL);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String page = total.toString();
Dialog dialog = new Dialog(Main.this);
dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle(R.string.changelog);
dialog.setCanceledOnTouchOutside(true);
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setTextSize(13);
text.setText(page);
dialog.show();
} catch (Exception e) {
//handle the exception !
}
Это работает на Android 2.3 и ниже ... Но после обновления ICS я ничего не получаю!
Нет диалога, нет ответа, нет ничего! Помогите! : /