Get image of an arrangement

0

I'm occupying the next ImagePicker library for Android (Java), but I'm working with recovery, which I'm referring to this, to the method onActivityResult , which returns an array of images, in my case I limited the Picker to 1 photo at most and therefore I need to obtain the image to place it in an Imageview, the code I have is this:

public class EditarPerfil extends AppCompatActivity {


    private ArrayList<Image> images = new ArrayList<>();
    private int REQUEST_CODE_PICKER = 2000;
    private TextView name,status,email,edad,birthday,telefono;
    CircleImageView foto;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_editar_usuario);

        Typeface face1 = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Semibold.ttf");
        Typeface face2 = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Light.ttf");


        status = (TextView)findViewById(R.id.descripcion);
        email=(TextView)findViewById(R.id.emailEdit);
        name=(TextView)findViewById(R.id.Name);
        name.setTypeface(face1);
        status.setTypeface(face2);

        foto=(CircleImageView) findViewById(R.id.ProfileImageEdit);

        foto.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                ImagePicker.create(EditarPerfil.this)
                        .folderMode(false)
                        .folderTitle("Imagenes")
                        .imageTitle("Selecciona una imágen") 
                        .single() 
                        .limit(1)
                        .showCamera(true) 
                        .imageDirectory("Camera") 
                        .origin(images) 
                        .start(REQUEST_CODE_PICKER);
            }
        });
    }

   @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
       if (requestCode == REQUEST_CODE_PICKER && resultCode == RESULT_OK && data != null) {
           ArrayList<Image> images = data.getParcelableArrayListExtra(ImagePickerActivity.INTENT_EXTRA_SELECTED_IMAGES);
           // foto.setImageBitmap();
            }
        else {
            TastyToast.makeText(getApplicationContext(),"Operacion Cancelada", TastyToast.LENGTH_LONG, TastyToast.ERROR);
        }
    } }

I hope you can help me, thank you in advance

    
asked by zhet 20.03.2017 в 22:05
source

1 answer

0

it was enough just to add 2 lines so that the picker would place the image on the imageView

File imgFile = new  File(images.get(0).getPath());
Picasso.with(this).load(imgFile).resize(100,100).into(foto);

I add the answer in case someone has the same problem

    
answered by 20.03.2017 / 23:49
source