Simon Leung
asked on
Java Code query
in the java code below, what does (Bitmap..bitmap) mean ?
Thx
protected void onProgressUpdate (Bitmap... bitmap) {
img.setImageBitmap(bitmap[0]);
}
Thx
protected void onProgressUpdate (Bitmap... bitmap) {
img.setImageBitmap(bitmap[0]);
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
So you can send as many Bitmaps to the function as you need. But you can only have one varargs per parameter list, and if other args are included, the varargs must come last.
Just to further clarify, this means you can call to the method like this:
It's just to save the caller from having to make the array themselves.
Bitmap first ;
Bitmap second ;
onProgressUpdate(first);
onProgressUpdate(first, second);
Java collects up the list of arguments and turns then into a Bitmap array which is then passed to the function.It's just to save the caller from having to make the array themselves.