title: How to save Integer to Database(SQLite)
body: <p>In my program, I have a database and there is a table in my database in the name of the student , In the student table, there is a column named StudentID that should save ten numbers now my problem is The Student ID column can not save the numbers,When I enter numbers less than ten it shows the save message but in logcat have error and when I enter the ten numbers, it will be out from the program.</p>
  
  <p>Sorry for my poor English language.</p>
  
  <p>SQLite Code For Student Table : </p>
  
  <pre><code>create table student(student_id integer(10) primary key not null , class_id int , student_name nvarchar(50) , FOREIGN KEY (class_id) REFERENCES class(class_id))
  </code></pre>
  
  <p>Save Student Method :</p>
  
  <pre><code>    public void SaveStudent(int studentId , int classID , String studentName)
  {
      ContentValues values = new ContentValues();
  
      values.put("student_id" , studentId);
      values.put("class_id" , classID);
      values.put("student_name" , studentName);
  
      database.insert("student" , null , values);
  
      Toast.makeText(context, "Save!" , Toast.LENGTH_SHORT).show();
  }
  </code></pre>
  
  <p>Get Student Information :</p>
  
  <pre><code>    Button saveStudent_btn = (Button)viewLayout.findViewById(R.id.item_btn_SaveStudent);
  
      saveStudent_btn.setOnClickListener(new View.OnClickListener() {
                          @Override
      public void onClick(View v) {
  
      HashMap&lt;String, Object&gt; obj = (HashMap&lt;String, Object&gt;)     adapter.getItem(position);
      int classId = (int) obj.get("class_id");
  
      EditText studentName_et = (EditText)viewLayout.findViewById(R.id.item_et_StudentName);
      String studentName = studentName_et.getText().toString();
  
      EditText studentId_et = (EditText)viewLayout.findViewById(R.id.item_et_StudentId);
      int studentId = Integer.parseInt(studentId_et.getText().toString());
  
      database.OpenDatabase();
      database.SaveStudent(studentId , classId , studentName);
      database.close();
  
      }
      });
  </code></pre>
  
  <p>Logcat error for when entered 10 numbers: </p>
  
  <pre><code>02-23 19:05:07.850 1896-1896/com.example.user.classmanager E/AndroidRuntime: FATAL EXCEPTION: main
          Process: com.example.user.classmanager, PID: 1896
          java.lang.NumberFormatException: Invalid int: "4318659489"
          at java.lang.Integer.invalidInt(Integer.java:138)
          at java.lang.Integer.parse(Integer.java:413)
          at java.lang.Integer.parseInt(Integer.java:367)
   com.example.user.classmanager.SecondTab$1$1$1.onClick(SecondTab.java:94)
          at android.view.View.performClick(View.java:5225)
          at android.view.View$PerformClick.run(View.java:21195)
          at android.os.Handler.handleCallback(Handler.java:739)
  </code></pre>
  
  <p>logcat error for less then 10 numbers : </p>
  
  <pre><code>  02-23 19:42:32.502 10388-10388/com.example.user.classmanager E/SQLiteDatabase: Error inserting 
  
  android.database.sqlite.SQLiteConstraintException: UNIQUE constraint failed: student.student_id (code 1555)
  at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
  at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:780)
  at com.example.user.classmanager.DatabaseHandler.SaveStudent(DatabaseHandler.java:189)
  at com.example.user.classmanager.SecondTab$1$1$1.onClick(SecondTab.java:97)
  </code></pre>