I need to pass a primitive int array (int[]) via intent extras, and use them in an extended BaseAdapter class, so I need to convert int[] to Integer[]
How can I do this?
I need to pass a primitive int array (int[]) via intent extras, and use them in an extended BaseAdapter class, so I need to convert int[] to Integer[]
How can I do this?
 
    
     
    
    I am afraid theres no better solution than this
int[] a1 = ...
Integer[] a2 = new Integer[a1.length];
for(int i = 0; i < a1.length; i++)
   a2[i] = a1[i];
 
    
    From @Eddie's answer here, you might want to look at this if you have access to the Apache lang library:
   Integer[] newArray = ArrayUtils.toObject(oldArray);
 
    
    