CS Upload Button Click

Advertisements
public void uploadPhoto(View view) {
        if(imageUri!=null)
        storageReference.child("images/test_image.png").putFile(imageUri).addOnCompleteListener(new OnCompleteListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onComplete(@NonNull Task<UploadTask.TaskSnapshot> task) {
                if(task.isSuccessful()){
                    Toast.makeText(MainActivity.this, "Upload completed", Toast.LENGTH_SHORT).show();
                }else{
                    Toast.makeText(MainActivity.this, "Something went wrong: " + task.getException().getLocalizedMessage(), Toast.LENGTH_SHORT).show();
                    Log.e(TAG, "onComplete: " +task.getException().getLocalizedMessage() );
                }
            }
        });
    }