Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>I'm still struggling to find a clean easy way to load some values in my onCreate method and pass them to another class in order that a game may load and save option settings.</p> </blockquote> <p>Use <code>SharedPreferences</code> -- that is why they are there.</p> <blockquote> <p>Anyone got any helpful ideas?</p> </blockquote> <p>Either:</p> <ul> <li>Your other class is not talking to the <code>Activity</code> object you think it is, or</li> <li>You are not calling the code in the other class that invokes your setter, or</li> <li>Your activity is being recreated (e.g., configuration change) as part of your testing, or</li> <li>As @Arnout Engelen notes, you are calling the setter from multiple places and are overwriting what you want, or</li> <li>Something else, since the code you have above most likely is not really the code from your app, and fake examples like this just cause problems when you go to ask people for help, because you introduce differences between what you're really running and what you're claiming you're running</li> </ul> <hr> <p><strong>UPDATE</strong> You are creating a <code>Vortex</code> via <code>new Vortex()</code>. <code>Vortex</code> is an <code>Activity</code>. Never create activities via the constructor. You do not access activities from other activities. Your red/green/blue values need to be in some data model accessible from all your components.</p> <p>Given your code and comments, I strongly encourage you to first learn Java outside of Android, then learn Android.</p>
 

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