[android-developers] Re: Understanding how the Final keyword in Android Works

2017-01-05 Thread Clinton Brits
Hi. Im not sure if this topic is still active but could i ask you to elaborate? I checked a few youtube videos and the author says he declares final variables that will be saved if anyone leaves the app and comes back and he sets the value in onsaveinstancestate. The problem is he declares

[android-developers] Re: Understanding how the Final keyword in Android Works

2010-01-24 Thread jotobjects
On Jan 20, 10:49 am, Burk Hufnagel silveran...@gmail.com wrote: Tim, This is not an Android thing, it's a Java thing. Because the anonymous instance of OnClickListener can exist after the onCreate method completes its execution, you have to declare that builder is final otherwise it will be

[android-developers] Re: Understanding how the Final keyword in Android Works

2010-01-20 Thread Streets Of Boston
The 'final' keyword is not android specific. It is a java keyword that declares that the variable-reference can never be changed after it has been defined. e.g. final int x; x = 10; // OK x = 20; // Compiler error, since x is declared final and cannot be changed. final String age; if (x = 0)

[android-developers] Re: Understanding how the Final keyword in Android Works

2010-01-20 Thread jotobjects
builder is a local variable in scope of the onCreate method and is used in the anonymous inner class (new OnClickListener). Java keeps a copy of that local variable inside the listener object so Final ensures that the copy is consistent - you are not allowed to assign builder to some other value