我知道这必须简单.但对于我的生活,我不知道为什么我不能做到这一点.
好的,所以我想从列表视图页面(得到那个)然后点击一个开关使它进入下一页(也得到了.)然后我想要一个int告诉我我在最后一页的位置(可能正在工作?)现在我无法在页面中使用If Else语句.
public class NightmareParts extends Activity { public int current_AN_Number = NightmareList.AN_position_num; private TextView edit_title; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.part_layout); // isn't working here. Why? // test_edit = (TextView)findViewById(R.id.directions_tv); // test_edit.setText(R.string.directions_text_two); // works without this being in here. setDoneButtonListener(); } //Set up the Done button to initialize intent and finish private void setDoneButtonListener() { Button doneButton = (Button) findViewById(R.id.back_button); doneButton.setOnClickListener (new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void editTitle() { if (current_AN_Number = 1) { edit_title = (TextView)findViewById(R.id.part_title); edit_title.setText(R.string.AN_title_1); } } }
current_AN_number来自最后一页.