porque la clase ReadInputTask no invoca al metodo onPostExecute
Publicado por josuto (3 intervenciones) el 19/12/2015 21:09:01
Hola compañeros, que estoy haciendo mal para que la clase ReadInputTask no invoque nunca al metodo onPostExecute, segun android developers debe hacerlo despues de doInBavkground. Os pongo el codigo:
Venga, a ver si podeis hecharme una mano y voy acabando el proyecto.
Muchas gracias
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
private class ReadInputTask extends AsyncTask<InputStream, String, Void> {
@Override
protected Void doInBackground(InputStream... inps) {
//String p;
InputStream inputStream = inps[0];
byte[] buffer = new byte[256]; // buffer store for the stream
int bytes; // bytes returned from read()
while (inps != null) {
try {
// Read from the InputStream
bytes = inputStream.read(buffer);
if (bytes > 0) {// Get number of bytes and message in "buffer"
publishProgress(new String(buffer, 0, bytes, "UTF-8"));
// p.concat(byte[]):
}
} catch (Exception e) {
// To be done
}
}
return null;
}
protected void onProgressUpdate(String... values) {
String input = values[0];
appendText(input);
}
//@Override
protected void onPostExecute(String... result) {
termino();
}
}
Muchas gracias
Valora esta pregunta


0