Note that there are some explanatory texts on larger screens.

plurals
  1. POChange a Public Float Value within a Menu [Android]
    text
    copied!<p><strike> Basically I am making an app where there is a Ball On the screen and the size of the ball is determined by this code</p> <p><code>private static final float sBallDiameter = 0.011f;</code></p> <p>Is there any way i could create a menu system for the user , For example Like a pop up menu shown here </p> <p><a href="http://i.stack.imgur.com/WsHJX.png" rel="nofollow">http://i.stack.imgur.com/WsHJX.png</a></p> <p><br></p> <p>That would change the size of the ball , For example where on the menu above it says Map , Traffic , Street View etc. - I could use Small, Medium, Large </p> <p>Small, changing the <code>sBallDiameter</code> to something like 0.009f and large changing it to something like 0.018f </p> <p>I hope you get what i mean , but if someone could assist me on creating this menu type thing it would be great ! </strike> </p> <pre><code> **UPDATE :** </code></pre> <p>Here is the current Menu</p> <pre><code>private static final int Small= 1; public boolean onCreateOptionsMenu(Menu menu) { ((Activity) menu).onCreateOptionsMenu(menu); menu.add(0, Small, 0, "Small"); return true; } public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case Small: // here i want it to change the size down to something like 0.009f return true; } return false; } public float sBallDiameter = 0.013f; </code></pre> <p>Basically - What i want to do is make it so when the case "Small" is selected - it decreases the size of "sBallDiameter"</p> <ul> <li>I hope that clears things up a bit more -</li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload