protected void onPostExecute(JSONObject json) { int success; String mensaje; byte[] imageByteArray = null; try { success = json.getInt(Constantes.JSON_SUCCESS); mensaje = json.getString(Constantes.JSON_MESSAGE); if (success == 1) { // si fue bien JSONObject jsoncomment = json.getJSONObject("comment"); String imagepath = getActivity().getFilesDir() + "/images/" + Constantes.IMAGEN_PERFIL_FILENAME; File imagefile = new File(imagepath); if (imagefile.exists()) { Bitmap bitmap = BitmapFactory.decodeFile(imagepath); bitmap = Utilidades.redimensionarBitmap( bitmap, Constantes.THUMB_SIZE, Constantes.THUMB_SIZE); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); imageByteArray = stream.toByteArray(); } Comment comment = new Comment( imageByteArray, jsoncomment.getString("msg"), jsoncomment.getString("username"), jsoncomment.getString("timestamp"), Utilidades.getDevId(getActivity()), jsoncomment.getString("id")); addCommentToList(comment); commentsadapter.notifyDataSetChanged(); etCommentTxt.setText(""); // borramos el edittext } else { Toast.makeText(getActivity(), mensaje, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } pDialog.dismiss(); }