0
How do I convert ValueCallback<Uri>
for ValueCallback<Uri[]>
?
0
How do I convert ValueCallback<Uri>
for ValueCallback<Uri[]>
?
1
You cannot do this conversion for 3 reasons.
1 - You can only cast if there is a extends or Implements relation 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 is a detail. The cast will only work because the instance of the animal object is a Puppy. If you do it that way:
Animal animal = new Animal();
Cachorro cachorro = (Cachorro) animal;
The 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 it here:
List<Animal> list = new ArrayList<Cachorro>();
An Exception will be launched. Java does not convert the type being used in Generics, only the object that is using Generics which in this case are the Collections.
3 - You are trying to convert Uri to Uri[]. This makes no sense. You cannot convert a common object into a list. At least not via the language cast. What you might want to do is break a single Uri into several Uri. This is not a type conversion. In that case, you will need to create a convert.
Browser other questions tagged java type-conversion cast
You are not signed in. Login or sign up in order to post.
see if this can help you: http://stackoverflow.com/questions/10296734/image-uri-to-bytesarray?answertab=votes#tab-top
– Thiago Friedman
No... but thank you.
– Leonardo Patricio
You can’t make a simple cast because types are not compatible. Provide more details regarding the problem so that we can help better.
– Piovezan