How to find out if an ImageView has an informed photo

2

Hello, I want to create a conditional that checks whether all the fields on the screen were informed by the user or not. If anyone has not been informed, I would like to submit a toast showing the error. The problem is that on this screen I have an ImageView and I can not figure out when it was informed or not.

Code of this function:

if ((edtTitulo.getText().toString().isEmpty()) ||   (edtPreparo.getText().toString().isEmpty()) || (edtIngredientes.getText().toString().isEmpty())){
    Toast toast = Toast.makeText(getApplicationContext(), "Todos os campos são obrigatórios", Toast.LENGTH_LONG);
    toast.show();
}

How to add empty ImageView in this condition?

    
asked by anonymous 22.10.2017 / 22:44

1 answer

3

Depending on the method you used to assign the image to ImageView use

if(imageView.getDrawable() != null)

or

if(imageView.getBackground() != null)
    
22.10.2017 / 23:24