I searched about this error and i found it usually happen when you try to GetContent twice or more times, but the thing is, i am not, i have two almost identical methods, one works, the other don’t..
Method ParseHor() -Doesn’t work
public ArrayList<Hor> ParseHor() throws Exception{
ArrayList<Horario> listHorario = new ArrayList<Horario>();
HttpGet get = new HttpGet(
URL1);
HttpResponse response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent(); // Create an InputStream with the
BufferedReader reader = new BufferedReader(new InputStreamReader(is,
"iso-8859-1"));
StringBuilder sb = new StringBuilder();
...
}
ParseGrades() – Works
public ArrayList<Grade> ParseGrades() throws Exception {
HttpGet get = new HttpGet(
URL2);
HttpResponse response = httpClient.execute(get);
HttpEntity entity = response.getEntity();
InputStream is = entity.getContent(); // Create an InputStream with the
BufferedReader reader = new BufferedReader(new InputStreamReader(is,
"iso-8859-1"));
StringBuilder sb = new StringBuilder();
...
}
I tried to call just ParseHor(), but when it gets on the InputStream line, the exception rises with IllegalState – Content already consumed
Found it, the problem was that the name of the variables were the same, i changed that and worked.