java - ImageView post rotate fling cannot generate random number -
I am creating a Dialer Fling that can change the wheels, I am facing a problem, which I The number of dialer post method I want to generate random float so that each time the button is clicked so that they can velocity differently. When I was about to complete, I found it in the post method: Can not reference a non-final variable within an internal range defined in a different method I hope that something in the code You can make changes when the number given by post method each time I click on the button. Button Problem: You are randomizing only 1 value which is 0, so the result Always be zero, In addition to putting it outside the scope of the run method, you can be random Sample: instead of using
Dialer. Post (New Runnabel) {Float I = (Float) Math.Rendam (); // Last Float Suppose to be i = (float) Math.Rendam () @ Override Public Video Run () {Dialer Post (New Flingnerable (I))}}}); Public FlingRunnable (float velocity) {this.velocity = velocity; } @ Override Public Wide Run (If (Math.Abus (velocity)> 5 & amp; amp;; Rotating;) {rotateDialer (velocity / 75); velocity / = 1.0666F; // Post Dialer From (this);}}
float I = (float) math. RANDOM ();
Dialer Post (New RandomNXFlot 3 then it will generate a float category from 0-3
Math.Random
Random <
Comments
Post a Comment