【问题标题】:button in expandable list可展开列表中的按钮
【发布时间】:2023-03-07 08:37:01
【问题描述】:

我想在可展开列表的子项中创建一个按钮。

但是我得到空指针异常。

btnmore = (Button) findViewById(R.id.btn_more);
    btnmore.setOnClickListener(new OnClickListener() {
        public void onClick(View arg0) {
            Intent i = new Intent(getBaseContext(), ParticularNewsDetail.class); <-- got problem here
            startActivity(i);
        }
    });

我想点击按钮进入下一个活动。

怎么办?

【问题讨论】:

    标签: android button expandablelistview


    【解决方案1】:

    而不是给 getBaseContext() 尝试给你的classname.this。我猜这可能有用..

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-25
      • 1970-01-01
      • 1970-01-01
      • 2012-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多