androidparse-platformerror-handlingandroid-bitmapparse-android-sdk

java.lang.IllegalArgumentException: invalid type for value: class android.graphics.Bitmap


Hello i am adding to parse Platform a bitmap in a File but having some trouble here at the beggining it was working fine but after the second or third try i got messed up. i suppose that it is because the put method does not receive bitmaps. But i dont know why it worked at first and then stopped working.

this is my code...

    package com.example.mac.mycarapp.UI;

import android.support.v7.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v4.content.FileProvider;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SearchView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.support.v7.widget.Toolbar;
import com.example.mac.mycarapp.Adapter.DatosCompletosOtroAdapterSearch;
import com.example.mac.mycarapp.Adapter.RecyclerTouchListener;
import com.example.mac.mycarapp.LoginActivity;
import com.example.mac.mycarapp.Modelos.Ciudad;
import com.example.mac.mycarapp.R;
import com.example.mac.mycarapp.Util.Config;
import com.example.mac.mycarapp.Util.MarshMallowPermission;
import com.parse.FindCallback;
import com.parse.GetCallback;
import com.parse.GetDataCallback;
import com.parse.ParseException;
import com.parse.ParseFile;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import com.parse.ParseUser;
import com.parse.SaveCallback;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import de.hdodenhof.circleimageview.CircleImageView;


public class DatosCompletosClienteOtro extends AppCompatActivity implements AdapterView.OnItemSelectedListener {

    @BindView(R.id.imagen_por_tipo_de_empresa)
    ImageView imagenPorTipoDeEmpresa;
    @BindView(R.id.circleImageView3)
    CircleImageView circleImageView3;
    @BindView(R.id.inscripcion_nombre_cliente_otro)
    EditText inscripcionNombreClienteOtro;
    @BindView(R.id.inscripcion_cedula_cliente_otro)
    EditText inscripcionCedulaClienteOtro;
    @BindView(R.id.inscripcion_correo_cliente_otro)
    EditText inscripcionCorreoClienteOtro;
    @BindView(R.id.inscripcion_telefono_cliente_otro)
    EditText inscripcionTelefonoClienteOtro;
    @BindView(R.id.inscripcion_direccion_cliente_otro)
    EditText inscripcionDireccionClienteOtro;
    @BindView(R.id.inscripcion_ciudad_cliente_otro)
    Spinner inscripcionCiudadClienteOtro;
    @BindView(R.id.boton_seleccion_automotriz_otro)
    Button botonSeleccionAutomotriz;
    @BindView(R.id.boton_seleccion_inmobiliaria_otro)
    Button botonSeleccionInmobiliaria;
    @BindView(R.id.datos_completos_usuario_seleccion_empresa)
    TextView datosCompletosUsuarioSeleccionEmpresa;
    @BindView(R.id.datos_completos_buscar_empresa_por_sector)
    SearchView datosCompletosBuscarEmpresaPorSector;
    @BindView(R.id.recyclerview_relacion_escoge_empresa)
    RecyclerView recyclerviewRelacionEscogeEmpresa;
    @BindView(R.id.scrollView2)
    ScrollView scrollView2;
    ParseUser user;
    @BindView(R.id.boton_guardar_usuario_otro)
    Button botonGuardarUsuarioOtro;
    private ArrayList<String> listCiudad;
    private List<Ciudad> ciudadList;
    private Ciudad ciudadSelect;
    String stringTipoDeEmpresa;
    private ArrayList<ParseObject> listaEmpresa;
    DatosCompletosOtroAdapterSearch adapter;
    Context context = DatosCompletosClienteOtro.this;
    AlertDialog pd;
    String empresaObjectId;
    String tipoDeEmpAuto = "Automotriz";
    String tipoDeEmpInmo = "Inmobiliaria";
    Uri imageUrl;
    int CAMERA = 0;
    int GALLERY = 1;
    private MarshMallowPermission mmp;
    String ciudadId;
    String referentCiudad="null";
    String spinnerValue;

    public static final int REQUEST_IMAGE=100;
    public static final int REQUEST_GALLERY=101;

    Bitmap bitmap;




    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.datos_completos_usuario_inmobiliaria);
        ButterKnife.bind(this);

        ActionBar actionBar = getSupportActionBar();
        actionBar.setDisplayHomeAsUpEnabled(true);


        mmp = new MarshMallowPermission(this);

        listCiudad = new ArrayList<String>();
        ciudadList = new ArrayList<Ciudad>();
        listaEmpresa = new ArrayList<ParseObject>();

        AlertDialog.Builder db = new AlertDialog.Builder(this);
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View dialogView = inflater.inflate(R.layout.alert_inicial_uno, null);
        db.setView(dialogView);
        db.setCancelable(true);
        db.setPositiveButton("Siguiente", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                pd.dismiss();
            }
        });
        pd = db.create();
        pd.show();


        showUserDetailsIfInDatabase();

        user = ParseUser.getCurrentUser();


        //Todo:LLenar spinner con ciudades
        inscripcionCiudadClienteOtro.setOnItemSelectedListener(this);


        datosCompletosBuscarEmpresaPorSector.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override
            public boolean onQueryTextSubmit(String s) {
                return false;
            }

            @Override
            public boolean onQueryTextChange(String s) {
                adapter.getFilter().filter(s);

                return true;
            }
        });

        circleImageView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                openOptionPhotografy();
            }
        });

        recyclerviewRelacionEscogeEmpresa.addOnItemTouchListener(new RecyclerTouchListener(getApplicationContext(), recyclerviewRelacionEscogeEmpresa, new RecyclerTouchListener.ClickListener() {
            @Override
            public void onClick(View view, int position) {
                ParseObject item = listaEmpresa.get(position);
                String empresaSeleccion = item.getString("Nombre");
                empresaObjectId = item.getObjectId();
                user = ParseUser.getCurrentUser();
                user.put("Empresa", ParseObject.createWithoutData("Empresa", empresaObjectId));

            }

            @Override
            public void onLongClick(View view, int position) {

            }
        }));

        botonSeleccionAutomotriz.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                datosCompletosUsuarioSeleccionEmpresa.setText("");
                datosCompletosUsuarioSeleccionEmpresa.setText(tipoDeEmpAuto);
//                ParseQuery<ParseObject> query = ParseQuery.getQuery("Empresa");
//
//                // Retrieve the object by id
//                query.getInBackground(empresaObjectId, new GetCallback<ParseObject>() {
//                    public void done(ParseObject entity, ParseException e) {
//                        if (e == null) {
//                            // Update the fields we want to
//                            entity.put("tipoDeEmpresa", tipoDeEmpAuto);
//                        }
//                    }
//                });
                stringTipoDeEmpresa = datosCompletosUsuarioSeleccionEmpresa.getText().toString().trim();

                queryListadoDeEmpresas(stringTipoDeEmpresa);

            }
        });

        botonSeleccionInmobiliaria.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                datosCompletosUsuarioSeleccionEmpresa.setText("");
                datosCompletosUsuarioSeleccionEmpresa.setText(tipoDeEmpInmo);
//                ParseQuery<ParseObject> query = ParseQuery.getQuery("Empresa");
//
//                // Retrieve the object by id
//                query.getInBackground(empresaObjectId, new GetCallback<ParseObject>() {
//                    public void done(ParseObject entity, ParseException e) {
//                        if (e == null) {
//                            // Update the fields we want to
//                            entity.put("tipoDeEmpresa", tipoDeEmpInmo);
//                        }
//                    }
//                });
                stringTipoDeEmpresa = datosCompletosUsuarioSeleccionEmpresa.getText().toString().trim();
                queryListadoDeEmpresas(stringTipoDeEmpresa);

            }
        });

        botonGuardarUsuarioOtro.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                updateProfileUser();
                Intent intent=new Intent(DatosCompletosClienteOtro.this,MainActivity.class);
                startActivity(intent);
            }
        });


    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        Intent myIntent = new Intent(getApplicationContext(), LoginActivity.class);
        startActivityForResult(myIntent,0);
        return true;
    }

    private void lleneCiudadCliente(final String parameter) {
        ParseQuery<ParseObject> parseQuery = ParseQuery.getQuery("Ciudad");
        parseQuery.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> objects, ParseException e) {
                for (ParseObject ciudades : objects) {
                    Ciudad ciudad = new Ciudad(ciudades.getObjectId(), ciudades.getString("Ciudad"));
                    ciudadList.add(ciudad);
                    listCiudad.add(ciudades.getString("Nombre"));

                }
                ArrayAdapter<String> adapter = new ArrayAdapter<String>(DatosCompletosClienteOtro.this,
                        android.R.layout.simple_spinner_dropdown_item, listCiudad);
                inscripcionCiudadClienteOtro.setAdapter(adapter);
                if (!parameter.equals("null")) {
                    int selectionPosition = adapter.getPosition(parameter);
                    inscripcionCiudadClienteOtro.setSelection(selectionPosition);
                }

            }
        });

    }

    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
      spinnerValue=   adapterView.getItemAtPosition(position).toString();
      String idValue= String.valueOf(adapterView.getSelectedItemId());
      String item= listCiudad.get(position);
        ciudadSelect = ciudadList.get(position);
                ciudadId=ciudadSelect.getId();

//        switch (adapterView.getId()) {
//            case R.id.inscripcion_ciudad_cliente:
//                ciudadSelect = ciudadList.get(position);
//                ciudadId=ciudadSelect.getId();
//                break;
//
//        }

    }

    @Override
    public void onNothingSelected(AdapterView<?> parent) {

    }

    private void showUserDetailsIfInDatabase() {

        ParseUser parseUser = ParseUser.getCurrentUser();
        if (parseUser != null) {
            if (parseUser.getString("Nombre") != null) {
                inscripcionNombreClienteOtro.setText(parseUser.getString("Nombre"));
                Log.i("nombre:", parseUser.getString("Nombre"));
            }
            if(parseUser.getString("Cedula") != null) {
                inscripcionCedulaClienteOtro.setText(parseUser.getString("Cedula"));
            }
            if(parseUser.getEmail()!=null) {
                inscripcionCorreoClienteOtro.setText(parseUser.getEmail());
            }
            if(parseUser.getNumber("Telefono")!=null) {
                inscripcionTelefonoClienteOtro.setText(parseUser.getInt("Telefono") + "");
            }
            if(parseUser.getString("Direccion")!=null) {
                inscripcionDireccionClienteOtro.setText(parseUser.getString("Direccion"));
            }


            ParseQuery<ParseUser> query = ParseUser.getQuery();
            query.whereEqualTo("objectId", ParseUser.getCurrentUser().getObjectId());
            query.setCachePolicy(ParseQuery.CachePolicy.NETWORK_ELSE_CACHE);
            query.include("Ciudad");
            query.include("Marca");

            query.findInBackground(new FindCallback<ParseUser>() {
                public void done(final List<ParseUser> objects, ParseException e) {
                    if (e == null) {
                        Log.d("Resultados ", "" + objects.size());

                        for (ParseObject pointer : objects) {

                            ParseObject ciudades = pointer.getParseObject("Ciudad");
                            if (ciudades != null) {
                                lleneCiudadCliente(ciudades.getString("Nombre"));
                            } else {
                                lleneCiudadCliente("null");
                            }
                        }
                    }
                }
            });


            ParseFile parseFile = parseUser.getParseFile("Avatar");
            if (parseFile != null) {
                parseFile.getDataInBackground(new GetDataCallback() {
                    @Override
                    public void done(byte[] data, ParseException e) {
                        if (e == null) {
                            Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
                            if (bmp != null) {
                                circleImageView3.setImageBitmap(bitmap);
                            }
                        }
                    }
                });
            }
        }


    }

    private void updateProfileUser() {
        if (datosCompletosUsuarioSeleccionEmpresa.getText().toString().matches("")
        ) {
            Config.simpleAlert("Porfavor seleccione un tipo de empresa", this);


        }
        if (inscripcionNombreClienteOtro.getText().toString().matches("") ||
                inscripcionCedulaClienteOtro.getText().toString().matches("") ||
                inscripcionTelefonoClienteOtro.getText().toString().matches("") ||
                inscripcionDireccionClienteOtro.getText().toString().matches("")

        ) {
            Config.simpleAlert("Debe ingresar sus datos de perfil", this);

        } else {

            Config.showDP("Guardando registros...", this);
            ParseUser currUser = ParseUser.getCurrentUser();
            currUser.put("Nombre", inscripcionNombreClienteOtro.getText().toString().trim());
            currUser.put("Cedula", inscripcionCedulaClienteOtro.getText().toString().trim());
            currUser.put("email", inscripcionCorreoClienteOtro.getText().toString().trim());
            currUser.put("Telefono", Integer.parseInt(inscripcionTelefonoClienteOtro.getText().toString().trim()));
            currUser.put("Direccion", inscripcionDireccionClienteOtro.getText().toString().trim());
            currUser.put("Ciudad", ParseObject.createWithoutData("Ciudad", ciudadId));
            currUser.saveInBackground();


//            Bitmap bitmap = ((BitmapDrawable) circleImageView3.getDrawable()).getBitmap();
//            Bitmap bm = Config.scaleBitmapToMaxSize(240, bitmap);
//            ByteArrayOutputStream stream = new ByteArrayOutputStream();
//            bm.compress(Bitmap.CompressFormat.JPEG, 100, stream);
//            byte[] bytesArray = stream.toByteArray();
//            ParseFile imageFile = new ParseFile("image.jpg", bytesArray);
//            currUser.put("Avatar", imageFile);
//            currUser.saveInBackground();

//            currUser.saveInBackground(new SaveCallback() {
//                @Override
//                public void done(ParseException e) {
//
//                    if (e == null) {
//
//                        Config.hidePD();
//                        Config.simpleAlert("Datos guardados correctamente", DatosCompletosClienteOtro.this);
//                    } else {
//                        Toast.makeText(DatosCompletosClienteOtro.this, e.getMessage(), Toast.LENGTH_SHORT).show();
//                        Config.hidePD();
//                    }
//                }
//            });


        }
    }

    private void queryListadoDeEmpresas(String stringTipoDeEmpresa) {

        ParseQuery<ParseObject> query = ParseQuery.getQuery("Empresa");
        query.whereEqualTo("tipoDeEmpresa", stringTipoDeEmpresa);
        query.include("Ciudad");
        query.findInBackground(new FindCallback<ParseObject>() {
            @Override
            public void done(List<ParseObject> objects, ParseException e) {
                for (ParseObject obj : objects
                ) {
                    listaEmpresa.add(obj);

                }

                recyclerviewRelacionEscogeEmpresa.addItemDecoration(new DividerItemDecoration(getApplicationContext(),
                        LinearLayoutManager.VERTICAL));
                // Pass results to ListViewAdapter Class
                recyclerviewRelacionEscogeEmpresa.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
                adapter = new DatosCompletosOtroAdapterSearch(getBaseContext(), listaEmpresa);
                // Binds the Adapter to the ListView
                recyclerviewRelacionEscogeEmpresa.setAdapter(adapter);
                adapter.notifyDataSetChanged();
            }
        });


    }

    private void openOptionPhotografy() {
        android.support.v7.app.AlertDialog.Builder alert = new android.support.v7.app.AlertDialog.Builder(DatosCompletosClienteOtro.this);
        alert.setTitle("Seleccione una opción")
                .setIcon(R.mipmap.ic_launcher_round)
                .setItems(new CharSequence[]{"Tomar fotografía", "Seleccionar de galería"}, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int which) {
                        switch (which) {
                            case 0:
                                if (!mmp.checkPermissionForCamera()) {
                                    mmp.requestPermissionForCamera();
                                } else {
                                    openCameraIntent();

                                }
                                break;
                            case 1:
                                if (!mmp.checkPermissionForReadExternalStorage()) {
                                    mmp.requestPermissionForReadExternalStorage();
                                } else {
                                    openImageGallery();
                                }
                                break;
                        }
                    }
                })
                .setNegativeButton("Cancelar", null);
        alert.show();
    }

//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
//        super.onActivityResult(requestCode, resultCode, data);
//
//        if (resultCode == Activity.RESULT_OK) {
//            Bitmap bm = null;
//            //Image from camera
//            if (requestCode == CAMERA) {
//                try {
//                    bm = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUrl);
//
//
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//
//            } else if (requestCode == GALLERY) {
//                try {
//                    bm = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), data.getData());
//
//                } catch (IOException e) {
//                    e.printStackTrace();
//                }
//            }
//            //set image
//            circleImageView3.setImageBitmap(bm);
//            ParseUser currentUser = ParseUser.getCurrentUser();
//            if (currentUser != null) {
//                // Other attributes than "email" will remain unchanged!
//                currentUser.put("Avatar", bm);
//                currentUser.saveInBackground();
//                //mm
//            }
//        }
//    }

private void openCameraIntent(){
        Intent pictureIntent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        if(pictureIntent.resolveActivity(getPackageManager())!=null){
            startActivityForResult(pictureIntent,REQUEST_IMAGE);

        }
}

private void openImageGallery(){

        Intent photoPickerIntent=new Intent(Intent.ACTION_PICK);

        File pictureDirectory=Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
        String picDirectoryPath=pictureDirectory.getPath();
        Uri data=Uri.parse(picDirectoryPath);


        photoPickerIntent.setDataAndType(data,"image/*");

        startActivityForResult(photoPickerIntent,REQUEST_GALLERY);


}

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode== REQUEST_IMAGE && resultCode==RESULT_OK){
            if(data!=null && data.getExtras()!=null ){
                bitmap=(Bitmap)data.getExtras().get("data");
                circleImageView3.setImageBitmap(bitmap);
                user.put("Avatar",bitmap);
                user.saveInBackground();
            }
        }
        if(requestCode==REQUEST_GALLERY && resultCode==RESULT_OK){
            Uri imageUri=data.getData();

            InputStream inputStream;

            try {
                inputStream=getContentResolver().openInputStream(imageUri);
                Bitmap image=BitmapFactory.decodeStream(inputStream);
                circleImageView3.setImageBitmap(image);
                user.put("Avatar",image);
                user.saveInBackground();


            } catch (FileNotFoundException e) {
                e.printStackTrace();
                Toast.makeText(this,"No fue posible abrir la imagen",Toast.LENGTH_LONG).show();
            }

        }
    }
}

The problem is here: user.put("Avatar",bitmap);

This is the error code...

  
2019-07-08 14:58:41.798 1734-27078/? E/OMXNodeInstance: getConfig(0xee426d80:google.vorbis.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: Undefined(0x80001001)
2019-07-08 14:58:41.988 30043-30043/com.example.mac.mycarapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.mac.mycarapp, PID: 30043
    java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=100, result=-1, data=Intent { act=inline-data (has extras) }} to activity {com.example.mac.mycarapp/com.example.mac.mycarapp.UI.DatosCompletosClienteOtro}: java.lang.IllegalArgumentException: invalid type for value: class android.graphics.Bitmap
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4360)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402)
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.IllegalArgumentException: invalid type for value: class android.graphics.Bitmap
        at com.parse.ParseObject.performPut(ParseObject.java:3034)
        at com.parse.ParseObject.put(ParseObject.java:3013)
        at com.parse.ParseUser.put(ParseUser.java:814)
        at com.example.mac.mycarapp.UI.DatosCompletosClienteOtro.onActivityResult(DatosCompletosClienteOtro.java:564)
        at android.app.Activity.dispatchActivityResult(Activity.java:7454)
        at android.app.ActivityThread.deliverResults(ActivityThread.java:4353)
        at android.app.ActivityThread.handleSendResult(ActivityThread.java:4402) 
        at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:49) 
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108) 
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6669) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
2019-07-08 14:58:42.209 1915-1999/system_process E/InputDispatcher: channel '53feb7f com.example.mac.mycarapp/com.example.mac.mycarapp.UI.DatosCompletosClienteOtro (server)' ~ Channel is unrecoverably broken and will be disposed!

So what should i do? Please help me ..

I have read a lot of stack post but none work


Solution

  • I have found your issue. First of all thank you very much for adding more code! This way I was able to figure out that you are using the parseplatform. I have looked at the javadoc of the ParseUser class and found the following (for the method put):

    Add a key-value pair to this object. It is recommended to name keys in camelCaseLikeThis.

    Overrides: put in class ParseObject Parameters:
    key - Keys must be alphanumerical plus underscore, and start with a letter.
    value - Values may be numerical, String, JSONObject, JSONArray, JSONObject.NULL, or other ParseObjects. value may not be null.

    So you cannot store a Bitmap via put. To solve this issue, store the avatar in the filesystem (this will help you). And once the avatar is stored, save the path to it like this: user.put("avatarPath", <pathToAvatar>);. Now when you want to display the image, just get the path of it and read it from the storage.