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

Breaking down the planning logic of big promotion membership activities!

1. Case Study Xiao Ming has been signing in at a ...

Why are there always long lines in the women's restroom? What can we do?

I went to the bathroom with my boyfriend at the s...

Baidu promotes Baidu Baitong’s advertising advantages and billing methods!

What are the advantages of Baidu Baitong? l Resou...

OTT boxes are in a period of pain and may develop into overseas markets

Internet set-top boxes have received extra "...

What? Cockroaches can also make oil? Cooking oil!

What? Cockroaches can also make oil? Cooking oil?...

Elements and channels of product promotion plan!

The general promotion process is as follows: 1. M...

Tik Tok operation and promotion: 3 steps to create a hit product!

On June 12, 2018, the short video app Douyin anno...

Introduction to the use of Android classic sliding menu SlidingMenu

SlidingMenu is an open source Android development...

How to do ASO optimization (Must read for App operation and promotion)

Share outline: 1. ASO optimization 2. How to do b...