telen0928 2013-07-30 13:14 采纳率: 0%
浏览 2265

出现了fatal exception :main 这是其中的一段代码,大家看看有什么问题

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
loginBtn = (Button)findViewById(R.id.login_btn_login);
registerBtn = (Button)findViewById(R.id.login_btn_zhuce);
inputUsername = (EditText)findViewById(R.id.login_edit_account);
inputPassword = (EditText)findViewById(R.id.login_edit_pwd);

    sp = getSharedPreferences("userdata",0);
    //初始化数据
    LoadUserdata();

    //检查网络
    CheckNetworkState();

    //监听记住密码选项
    saveInfoItem.setOnCheckedChangeListener(new CheckBox.OnCheckedChangeListener()  
    {  
        @Override  
        public void onCheckedChanged(CompoundButton buttonView,  
                boolean isChecked) {  
            // TODO Auto-generated method stub  
            //载入用户信息

            Editor editor = sp.edit();

            if(saveInfoItem.isChecked())
            {
                 //获取已经存在的用户名和密码
                String realUsername = sp.getString("username", "");
                String realPassword = sp.getString("password", "");
                editor.putBoolean("checkstatus", true);
                editor.commit();

                 if((!realUsername.equals(""))&&!(realUsername==null)||(!realPassword.equals(""))||!(realPassword==null))
                 {
                    //清空输入框
                    inputUsername.setText("");
                      inputPassword.setText("");
                      //设置已有值
                     inputUsername.setText(realUsername);
                     inputPassword.setText(realPassword);
                 }
            }else
            {
                editor.putBoolean("checkstatus", false);
                editor.commit();
                //清空输入框
                inputUsername.setText("");
                 inputPassword.setText("");
            }

        }  

    });  
  • 写回答

1条回答 默认 最新

  • 码密码密哄 2013-07-31 02:22
    关注

    看代码没看出什么问题,clean下或者重启eclipse试试

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器