View Single Post
Old 02-09-2010, 01:07 AM   #1 (permalink)
MobileDeveloperUK
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default Unable to set variable values inside the timer function

Please Login to Remove!

Hi

i am utilising the timer event to get the value from a text box and storing it into a variable after saving the previous value onto another variable


Timer timer = new Timer();
TimerTask updateTask;

String prevEntry;
String crntEntry;



updateTask = new TimerTask() {

public void run() {


prevEntry = crntEntry;

crntEntry = field1.gettext();

}

}

where field1 is declared as BasicEditField

But I am getting errors like

local variable crntEntry is accessed from within inner class; needs to be declared final
prevEntry = crntEntry;
^
Offline   Reply With Quote