Android source code warehouse management

Android source code warehouse management


Source code introduction

A simple warehouse management system, suitable for beginners to learn.
Source code screenshot

Source code snippet

  1. rotated void onCreate(Bundle savedInstanceState) {
  2. // TODO Auto-generated method stub  
  3. super .onCreate(savedInstanceState);
  4. setContentView(R.layout.userregister);
  5. name = (EditText) findViewById(R.id.usename);
  6. pass = (EditText) findViewById(R.id.password);
  7. passsure = (EditText) findViewById(R.id.passwordsure);
  8. workid = (EditText) findViewById(R.id.useide);
  9. db = new SqlHelpdemo(getApplicationContext(), "store.db" , null , 1 );
  10. sDatabase = db.getWritableDatabase();
  11.   
  12. }
  13.   
  14. public   void sure(View v) {
  15. db = new SqlHelpdemo(getApplicationContext(), "store.db" , null , 1 );
  16. sDatabase = db.getWritableDatabase();
  17. if (name.getText().toString().equals( "" )
  18. || pass.getText().toString().equals( "" )
  19. || passsure.getText().toString().equals( "" )
  20. || workid.getText().toString().equals( "" )) {
  21.   
  22. DialogDemo.builder(UserRegister. this , "Error message" , "Please fill in the complete information!" );
  23.   
  24. } else   if (!pass.getText().toString()
  25. .equals(passsure.getText().toString())) {
  26. DialogDemo.builder(UserRegister. this , "Error message" , "The two passwords you entered are inconsistent!" );
  27. } else {
  28. String ename = name.getText().toString();
  29. String epass = pass.getText().toString();
  30. String eid = workid.getText().toString();
  31. // Query statement  
  32. String selectStr = "select username from user_info" ;
  33. Cursor select_cursor = sDatabase.rawQuery(selectStr, null );
  34. select_cursor.moveToFirst();
  35. String string = null ;
  36. do {
  37. try {
  38. string = select_cursor.getString( 0 );
  39. } catch (Exception e) {
  40. // TODO: handle exception  
  41. string = "" ;
  42. }
  43. if (string.equals(ename)) {
  44. DialogDemo.builder(UserRegister. this , "error message" ,
  45. "The username already exists, please create another username" );
  46. select_cursor.close();
  47. break ;
  48.   
  49. }
  50. } while (select_cursor.moveToNext());
  51. // Start without duplicate registration  
  52. if (!string.equals(ename)) {
  53. // Define ID  
  54. int id = 0 ;
  55. String select = "select max(_id) from user_info" ;
  56. Cursor seCursor = sDatabase.rawQuery(select, null );
  57. try {
  58. seCursor.moveToFirst();
  59. id = Integer.parseInt(seCursor.getString( 0 ));
  60. id += 1 ;
  61. } catch (Exception e) {
  62. // TODO: handle exception  
  63. id = 0 ;
  64. }
  65. sDatabase.execSQL( "insert into user_info values('" + id + "','"  
  66. + ename + "','" + epass + "','"  
  67. + eid + "')" );
  68. DialogDemo.builder(UserRegister. this , "Prompt" , "Registration successful, please return to the login interface to log in" );
  69.                   
  70. seCursor.close();
  71.               
  72.                   
  73. }
  74. }
  75.   
  76. }
  77.   
  78. }

Source code link: http://download..com/data/2009972

<<:  Star Rating

>>:  Verification code countdown

Recommend

Why is the pressure of raising children increasing?

Leviathan Press: The nuclear family model of rais...

The most comprehensive APP operation and promotion plan!

Now that you have the APP, the next step is to op...

Tesla will launch a mini car, Musk said it is building

Tesla has cooperated with RadioFlyer to launch th...

How an ice crystal can teach us more about our environment and climate

When a fluffy, soft cloud appears on the horizon,...

How can iOS be reliable in recruitment?

I have interviewed many people in the past year. ...

Community operation methodology: how to gather target users

In early 2015, communities began to become popula...

5 social media trends to watch in 2016

[[161459]] In the past, we could only rely on two...

MultiChoiceAdapter—Easy to make ListView support multiple selections

introduce An adapter that provides multiple choic...

60 super practical new media operation and marketing tools!

As a new media operator , you need to be able to ...

58 Marketing Models That Strategists Must Know in 2022

Model in hand, ideas in mind The model is an effe...

It hurts to the bone! You must know this information about influenza B

[Danger! #Woman's two lungs turned white afte...

Baidu search promotion main process function upgrade

1. Background The main process of Baidu's sea...