title: Method still adding specified data, which should've added once
body: <p>that i have to change some methods from my program, because it didn't work that as i want to. I have a method which should add data to database if another method will find out there's missing data in specific table, then program should populate spinner by this data. I really don't know what is going on, i've checked my db multiple times, and it contain data,which should be added only one time.</p>
  
  <p>Here's some code:</p>
  
  <p>this method have to check, if there's any data in specifed table</p>
  
  <pre><code>public void checkDB() {
      DatabaseHelper db = new DatabaseHelper(getApplicationContext());
      if (db.shouldPopulate()) {
          Toast.makeText(this, "Spinners will be populated", Toast.LENGTH_SHORT).show();
          db.insertBodyParts();
      } else {
          Toast.makeText(this, "Spinners are already populated", Toast.LENGTH_SHORT).show();
      }
  }
  </code></pre>
  
  <p>this method have to load data from database into specifed spinner</p>
  
  <pre><code>public void loadBodyPartsMF() {
      List&lt;String&gt; data = db.getBodyParts();
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_spinner_item, data);
      adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
      firstBodyPartMonday.setAdapter(adapter);
  
      firstBodyPartMonday.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
          @Override
          public void onItemSelected(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
              mondayFirstBodyPartString = adapterView.getItemAtPosition(i).toString();
  
          }
  
          @Override
          public void onNothingSelected(AdapterView&lt;?&gt; adapterView) {
          }
      });
  }
  </code></pre>
  
  <p>Here's methods from database that should add and get data from table</p>
  
  <pre><code>public boolean insertBodyParts(){
      SQLiteDatabase db = this.getWritableDatabase();
      ContentValues contentValues = new ContentValues();
      contentValues.put(EXERCISES_CALF,"calf");
      contentValues.put(EXERCISES_LEGS,"legs");
      contentValues.put(EXERCISES_BACK,"back");
      contentValues.put(EXERCISES_SHOULDERS,"shoulders");
      contentValues.put(EXERCISES_BICEPS,"biceps");
      contentValues.put(EXERCISES_TRICEPS,"triceps");
      contentValues.put(EXERCISES_CHEST,"chest");
      contentValues.put(EXERCISES_ABS,"abs");
      contentValues.put(EXERCISES_FOREARM,"forearm");
  
      return db.insert(EXERCISES_TABLE_NAME,null,contentValues) != -1;
  }
  
  
  
  public List&lt;String&gt; getBodyParts() {
      List&lt;String&gt; labels = new ArrayList&lt;String&gt;();
      SQLiteDatabase db = this.getReadableDatabase();
      String selectQuery = "SELECT  * FROM " + EXERCISES_TABLE_NAME;
      Cursor cursor = db.rawQuery(selectQuery, null);
  
      if (cursor.moveToFirst()) {
          do {
              labels.add(cursor.getString(1));
              labels.add(cursor.getString(2));
              labels.add(cursor.getString(3));
              labels.add(cursor.getString(4));
              labels.add(cursor.getString(5));
              labels.add(cursor.getString(6));
              labels.add(cursor.getString(7));
              labels.add(cursor.getString(8));
              labels.add(cursor.getString(9));
          } while (cursor.moveToNext());
      }
      cursor.close();
      db.close();
  
      return labels;
  }
  </code></pre>
  
  <p>And here is how i've made this table etc.</p>
  
  <pre><code>private static final String EXERCISES_TABLE_NAME = "Body_parts";
  private static final String EXERCISES_CALF = "Calf";
  private static final String EXERCISES_LEGS = "Legs";
  private static final String EXERCISES_BACK = "Back";
  private static final String EXERCISES_SHOULDERS = "Shoulders";
  private static final String EXERCISES_BICEPS = "Biceps";
  private static final String EXERCISES_TRICEPS = "Triceps";
  private static final String EXERCISES_CHEST = "Chest";
  private static final String EXERCISES_ABS = "Abs";
  private static final String EXERCISES_FOREARM = "Forearm";
  
  
  
          db.execSQL("create table " + EXERCISES_TABLE_NAME + " (ID INTEGER PRIMARY KEY AUTOINCREMENT," + EXERCISES_CALF + " TEXT," + EXERCISES_LEGS + " TEXT," + EXERCISES_BACK + " TEXT," + EXERCISES_SHOULDERS + " TEXT," + EXERCISES_BICEPS + " TEXT," + EXERCISES_TRICEPS + " TEXT," + EXERCISES_CHEST + " TEXT," + EXERCISES_ABS + " TEXT," + EXERCISES_FOREARM + " TEXT)");
  
  
  @Override
  public void onUpgrade(SQLiteDatabase db, int i, int i1) {
      db.execSQL("DROP TABLE IF EXISTS " + EXERCISES_TABLE_NAME);
      onCreate(db);
  }
  </code></pre>
  
  <p>Why it's still adding the same data, if it already exists?</p>