Andriod小型管理系统(Activity,SQLite库操作,ListView操作)(源代码下载)

学习了一阵子的Android开发技术,花了几天,把不懂的,懂的晚上实践了一下,使用常用的各种方法

过几天要考驾校理论了,得看书了

 

系统登录时会自动添加用户 admin admin 登录后添加新记录,删除记录,修改密码等操作

上图

系统登录

 

 

 

数据列表
 

 

信息添加
 

 

修改密码

 

 

系统登录代码:

 

     butlogin.setOnClickListener(new OnClickListener() {
            
            @Override
            public void onClick(View v) {
                
                String user=txtuser.getText().toString();
                String Pass=txtpass.getText().toString();
            //    showDialog(user+"aaaaaaaaaaaaaaaaaaa"+Pass);    
                
                DBHelper dbhelper=new DBHelper(getApplicationContext());
                Cursor c=dbhelper.queryUser();
                  if(c.getCount()>0)
                  {
                
                      if(c.moveToFirst())
                     {
                          
                           c.move(0);
                           String id=c.getString(0);
                           String username=c.getString(1);
                           String userpass=c.getString(2);
                           if(user.equals(username)&&Pass.equals(userpass))
                           {
                             //  showDialog("正确");
                               
                               Intent intent=new Intent(Login.this,manage.class);
                                startActivity(intent);
                               
                           }
                           else
                           {
                                                   
                               showDialog("用户名或密码错误");
                               
                             
                           }
                         
                          
                         
                    
                      }
                  }
                  else
                  {
                        ContentValues values=new ContentValues();
                        values.put("username", "admin");
                        values.put("userpass", "admin");
                        
                        DBHelper helper=new DBHelper(getApplicationContext());
                        helper.insertUser(values);
                        
                        Intent intent=new Intent(Login.this,manage.class);
                        startActivity(intent);
                      
                  }
                
                
                
            }    
        });
        
        

       

代码比较简单,不贴了,具体请看代码 

源代码下载

点击下载

 

posted @ 2011-11-01 19:52  glory.xu  阅读(1090)  评论(0编辑  收藏  举报