I can't declare a global variable?

Put your problem here if it does not fit any of the other categories.

I can't declare a global variable?

Postby jmejiaa » Thu Nov 20, 2008 12:58 am

Hello, I need a state variable, a boolean to Know whether some buttons are numbers or not. I want an onClick event to read this and do some different things depending on if it is true or false. I keep getting the following:

Cannot refer to a non-final variable isNumbers inside an inner class defined in a different method

I have tried declaring it out of my onCreate with no luck.
jmejiaa
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Nov 15, 2008 6:36 pm

Top

Postby jmejiaa » Thu Nov 20, 2008 1:06 am

I think I solved it. This is what I did,

I declared it private static then referenced it with classname.isNumbers :)
jmejiaa
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Nov 15, 2008 6:36 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 16 guests