0
I am with this error when downloading an object from the webservice that has images that are converted to Base64. The point is that if this object is already saved in the local database of android the app works, I can load many objects at the same time and show on the screen, but now I’m downloading from the webservice this object, one by one, and some are giving this error due to the amount of images they have.
I do not understand why if these objects when they are already in the cell the memory does not burst, now when I download it happens that.
This happens only in android emulator in version 2.3. at the top they work normal. I can even download an array with all objects and their images.
Method responsible for downloading
public class Sincronismo {
public static String GET(Context context, String endereco){
//Verifica se existe conexão com a internet
if(!existeConexao(context))
return K.FALHA_CONEXAO;
InputStream inputStream = null;
HttpClient httpClient = new DefaultHttpClient();
String result = K.FALHA;
try{
HttpGet httpGet = new HttpGet(endereco);
HttpResponse httpResponse = httpClient.execute(httpGet);
inputStream = httpResponse.getEntity().getContent();
if(inputStream!=null)
result = inputStreamParaString(inputStream);
else
result = K.FALHA;
}catch(UnsupportedEncodingException e){
e.printStackTrace();
}catch(ClientProtocolException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
return result;
}
private static String inputStreamParaString(InputStream in) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String line="";
String result="";
while((line = br.readLine())!=null)
result += line;
in.close();
return result;
}
}
This is the method that makes the download, I leave here to analyze
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero