*> why avoid them like the plague? *

Here is some light reading on the subject:

http://c2.com/cgi/wiki?GlobalVariablesAreBad
http://en.wikipedia.org/wiki/Global_variable
http://stackoverflow.com/questions/2157685/why-no-global-variables-in-java-like-c

In general, it is considered a bad coding practice...

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Wed, Mar 9, 2011 at 2:15 PM, David Williams <[email protected]
> wrote:

>  Justin,
>
> Thanks for the information, I will have to look into just what subclassing
> the Application means/is and also SharedPreferences.
>
> That said, why avoid them like the plague?  If you don't use global
> variables then just how do you get some kind of static value (which is
> really what I'm after) available to all aspects of your app code?
>
> TreKing, will look into the public static values as this might be more of
> what I need.
>  ------------------------------
>
> David Williams
> Check out our WebOS mobile phone app for the Palm Pre and Pixi:
>  <http://www.dtw-consulting.com/GolfCaddie>   Golf 
> Caddie<http://www.dtw-consulting.com/GolfCaddie>| Golf
> Caddie Forum <http://www.dtw-consulting.com/GolfCaddie/forum> | Golf
> Caddie FAQ <http://www.dtw-consulting.com/GolfCaddie/faq.html> by
> DTW-Consulting, Inc.
>
>
>
> On 3/9/2011 3:05 PM, Justin Anderson wrote:
>
> The best way is to avoid them like the plague...
>
> If you can't then you can either subclass Application and make them
> available there or you can use SharedPreferences...
>
> Thanks,
> Justin Anderson
> MagouyaWare Developer
> http://sites.google.com/site/magouyaware
>
>
> On Wed, Mar 9, 2011 at 1:41 PM, David Williams <
> [email protected]> wrote:
>
>>  All,
>>
>> What is the best way of going about setting up global variables?  There
>> will be like 5-6 global variables that I would like to set when my app is
>> launched that are then available for any code anywhere in my app.
>> I did something similar to this under Mojo on WebOS.  I just set some
>> global variables during the stage-assistant.js script that could then be
>> used by any script.
>>
>> TIA.
>>  --
>> ------------------------------
>>
>> David Williams
>> Check out our WebOS mobile phone app for the Palm Pre and Pixi:
>>  <http://www.dtw-consulting.com/GolfCaddie>   Golf 
>> Caddie<http://www.dtw-consulting.com/GolfCaddie>| Golf
>> Caddie Forum <http://www.dtw-consulting.com/GolfCaddie/forum> | Golf
>> Caddie FAQ <http://www.dtw-consulting.com/GolfCaddie/faq.html> by
>> DTW-Consulting, Inc.
>>
>>
>>   --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

<<GClogo.png>>

Reply via email to