无法让我的if语句起作用?

 阳光下微醺的我 发布于 2023-02-12 12:39

我知道这必须简单.但对于我的生活,我不知道为什么我不能做到这一点.

好的,所以我想从列表视图页面(得到那个)然后点击一个开关使它进入下一页(也得到了.)然后我想要一个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来自最后一页.

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有