私はAndroidプログラム開発の初心者です...しかし、Androidフォンでオシロスコープを開発するタスクが与えられています..プログラムをデバッグすると、いくつかのプログラムが得られます。これらのコードを使用してオシロスコープのボタンを設定しました..
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);
と
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);
R.idの後にすべてのものを設定します。整数/フィールドになる..以下のようにRファイルに表示されます
しかし、Eclispe は、最後の 3 つのフィールドでプログラムを取得したことを教えてくれました...「btn_posiion_down」、「tbtn_runtoggle」、および「btn_postion_up」です。「ケース式は定数式でなければならない」というエラーが表示されます...i意味がわかりません...スクリプトの最初の文でエラーが発生します...
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;
誰か親切に何が起こるか教えてもらえますか??