android - Drawing random circles -


I am trying to attract a kampala circles on random posts in the Android application. I draw them on a bitmap and then draw that bitmap onto the canvas. This is the task to draw a circle:

  Private zero-less linear cycles (int number of orchcrints) {canvas c = new canvas (b); Paint cPaint = new paint; CPaitn.setColor (Color.RED); {Int x = Math.Random% 100; for int (i = 0; i & lt; numOfCircles; i ++); Int y = Math Random% 100; C.drawCircle (x, y, 20, cPaint)}}  

Bitmap B is global and after calling this function, I simply draw a bitmap in the otra method. Now the problem is that I have just drawn a circle on the screen, no matter, size of numOfCircles.

Any clue what's going on here?

This code also does not compile. For example, what's new paint?

I recommend that you log your logic to drawCircle to ensure that you attract them to different places. For example, if Math.Random is a field, it reads, which will circle the circle at the top of each other.

If you have Math.random () the error is that Math.random () returns the value between 0 and 1. You may want to use

  Random r = new random (); // your loop int x = r.nextInt (100); Int y = r.nextInt (100);  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -