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 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?