为了账号安全,请及时绑定邮箱和手机立即绑定

崩了,unfortunately,My Application has stopped!跪求支援

崩了,unfortunately,My Application has stopped!跪求支援

public class MainActivity extends Activity implements OnCheckedChangeListener{ private  ToggleButton     but1; private  ImageView        ima1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); but1 =(ToggleButton) findViewById(R.id.toggleButton1); ima1 = (ImageView) findViewById(R.id.imageView1);  but1.setOnCheckedChangeListener(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public void onCheckedChanged(CompoundButton buttonviwe, boolean isChecked) { // TODO Auto-generated method stub ima1.setBackgroundResource(isChecked?R.drawable.on:R.drawable.off); }
查看完整描述

2 回答

?
ewang1986

TA贡献27条经验 获得超5个赞

提供下报错堆栈信息,一般来说,答案就在其中

查看完整回答
反对 回复 2019-01-21
  • 2 回答
  • 0 关注
  • 2196 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信