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

How should brands measure the effectiveness of advertising on TikTok?

Short videos have become popular, and a question ...

What do ROI, CPA, CPC, and OCPM mean in SEM promotion?

In every industry, there are unique professional ...

The next "Earth"? Scientists discover a new habitable planet

Among the issues that the public is most concerne...

How to monitor a typhoon that “runs” throughout its life?

Recently, this year's fifth super typhoon &qu...

Refined operation of brand users turning into KOCs

For today’s brands, if they want to do well in th...

Do webpage titles and article titles mean the same thing?

Student asked: Do the webpage title and article t...

More than 660 alien species have invaded China

More than 660 alien species have invaded China (w...

The past and present of Android mobile phone interaction

On the home screen of most Android phones, you ca...

Why do some people feel “bad mentally” during mental health week?

In today's society, mental and psychological ...

How much does it cost to activate Baidu AiPurchasing? How to activate it?

Baidu Ai Procurement is like opening the door to ...