| |||||||
Das Thema "Timeout Fehler unter Android 4.0.1" befindet sich unter Android App Entwicklung auf Android-Hilfe.de.
|
| | Themen-Optionen | Ansicht |
| | #1 (permalink) |
| Junior Mitglied Registriert seit: 22.06.2010
Beiträge: 37
Abgegebene Danke: 3
Erhielt 0 Danke für 0 Beiträge
| meine App lief bisher auf unterschieldichen Plattformen und Versionen problemlos. Mit Android 4.0.1 allerdings kann ich keine Bilder mehr von unserem Server laden, sondern erhalte immer ein Timeout. Das hat definitiv mit dem Betriebssystem zu tun, denn ich kann den Fehler auf einem entsprechenden Emulator und einem externen Handy nachstellen. Der Timeout kommt beim Aufruf von der Methode getResponseCode in der Klasse HttpURLConnection. Hier der Code: Code: if (httpVerbindung != null) {
InputStream in = null;
try {
if (httpVerbindung.getResponseCode() == HttpURLConnection.HTTP_OK) {
getCookieData(httpVerbindung);
in = httpVerbindung.getInputStream();
int length = httpVerbindung.getContentLength();
if (length > 0) {
respData = new byte[length];
int total = 0;
while (total < length) {
total += in.read(respData, total, length - total);
}
}
else {
ByteArrayOutputStream bytestream = new ByteArrayOutputStream();
int ch;
while ((ch = in.read()) != -1) {
bytestream.write(ch);
}
respData = bytestream.toByteArray();
bytestream.close();
}
in.close();
}
} catch (IOException e) {
Protokoll.logError("downloadImage", String.format(BIS_Common.bisActivity.getString(R.string.exIOError, e.toString())));
}
finally {
if (in != null){
try {
in.close();
} catch (IOException e) {
Protokoll.logError("downloadImage", String.format(BIS_Common.bisActivity.getString(R.string.exInCloseError, e.toString())));
}
}
if (httpVerbindung != null) {
httpVerbindung.disconnect();
}
}
} Heureka! Gelöst: HttpURLConnection-Methode setDoOutput wurde mit true aufgerufen, obwohl ich kar keinen Body gesendet habe. Das macht wohl erst ab Version 4 etwas aus... Geändert von Gibbsnich (21.12.2011 um 16:10 Uhr) Grund: Gelöst! |
| | |
![]() |
|
| Themen-Optionen | |
| Ansicht | |
| |
| ||||
| Thema | Autor | Forum | Antworten | Letzter Beitrag |
| RUU Fehler 140 BOOTLOADER VERSION und FEHLER 131 BENUTZER-ID-FEHLER | Volleyboy10 | HTC Desire S Forum | 34 | 05.02.2012 14:40 |
| Unter Linux per Bluetooth auf S2 zugreifen: Fehler "permission denied"? | burnin | Samsung Galaxy S2 (I9100) Forum | 0 | 26.10.2011 10:26 |
| Fehler beim Update der Firmware unter Kies | redblack1893 | Samsung Galaxy Ace (S5830) Forum | 6 | 25.05.2011 21:22 |
| Goldcard Tool: Fehler unter Windows XP Prof | bfranz | Android Allgemein | 10 | 31.12.2010 17:56 |
| Android Im fehler | peter8940 | HTC Magic Forum | 0 | 27.09.2009 07:52 |