How do I convert ValueCallback<Uri>
to ValueCallback<Uri[]>
?
How do I convert ValueCallback<Uri>
to ValueCallback<Uri[]>
?
You can not do this conversion for 3 reasons.
1 - You can cast only if there is an extends or implements relationship between classes. Ex:
public class Animal {
}
public class Cachorro extends Animal {
}
In this case, you can do an upcasting:
Animal animal = new Cachorro();
or a downcasting:
Animal animal = new Cachorro();
Cachorro cachorro = (Cachorro) animal;
Here's a detail. The cast will only work, because the instance of the animal object is a Puppy. If you do it this way:
Animal animal = new Animal();
Cachorro cachorro = (Cachorro) animal;
Downcasting will fail.
2 - In java, we can do something like this:
List<Animal> list = new ArrayList<>();
ArrayList<Animal> arrayList = (ArrayList<Animal>)list;
But if we try to do this here:
List<Animal> list = new ArrayList<Cachorro>();
An exception will be thrown. The java does not convert the type that is being used in Generics, only the object that is using the Generics that in this case are the Collections.
3 - You are trying to convert Uri to Uri []. It makes no sense. You can not convert an ordinary object to a list. At least I did not see cast of language. What you may be wanting to do is break a single Uri into several Uri. This is not a type conversion. In this case, you will need to create a convert.