I am a beginner in android programme development...however I am given a task to develop an oscilloscope in android phone..I have got some program when I debugging the program. I have set the button for the oscilloscope using these code..
run_buton = (ToggleButton) findViewById(R.id.tbtn_runtoggle);
run_buton.setOnClickListener(this);
rb1 = (RadioButton)findViewById(R.id.rbtn_ch1);
rb2 = (RadioButton)findViewById(R.id.rbtn_ch2);
and
public static final int rbtn_ch1 = 0;
public static final int rbtn_ch2 = 0;
public static final int txt_ch1pos = 0;
public static final int txt_ch2pos = 0;
public static final int button_connect = 0;
public static final int WaveformArea = 0;
public static int btn_position_down;
public static int tbtn_runtoggle;
public static int btn_position_up;
btn_pos_up = (Button) findViewById(R.id.btn_position_up);
btn_pos_down = (Button) findViewById(R.id.btn_position_down);
btn_pos_up.setOnClickListener(this);
btn_pos_down.setOnClickListener(this);
and I set all things after R.id. to be an integer/field.. which shown in R file as below
however Eclispe told me that I have got program on the last three field...that are "btn_posiion_down","tbtn_runtoggle" and "btn_postion_up".. it shows error, saying that "case expression should be constant expressions"...i dont understand what it means...The first sentence of the script gets the error...
case R.id.btn_position_up :
if(rb1.isChecked() && (ch1_pos<38) ){
ch1_pos += 1; ch1pos_label.setPadding(0, toScreenPos(ch1_pos), 0, 0);
sendMessage( new String(new byte[] {ADJ_POSITION, CHANNEL1, ch1_pos}) );
}
else if(rb2.isChecked() && (ch2_pos<38) ){
ch2_pos += 1; ch2pos_label.setPadding(0, toScreenPos(ch2_pos), 0, 0);
sendMessage( new String(new byte[] {ADJ_POSITION, CHANNEL2, ch2_pos}) );
}
break;
May anyone kindly tells me what happens??