Link to home
Create AccountLog in
Avatar of Simon Leung
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]);
}

ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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.
Avatar of dpearson
dpearson

Just to further clarify, this means you can call to the method like this:

Bitmap first ;
Bitmap second ;
onProgressUpdate(first);
onProgressUpdate(first, second);

Open in new window

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.