title: Drop table if exits not works on SQlite database in Android
body: <p>I have a SQLite Database on Database, I store that database from PHP Server, I crete database, If I add new values to PHP databse it's appear on my android device, but...</p>
  
  <p><strong>MY PROBLEM</strong></p>
  
  <p>When I delete one value to Server database, on my device not delete from sqlite database, database is not updated only when I delete values from php database but yes works when I add values...</p>
  
  <p><strong>code DDBB</strong></p>
  
  <pre><code>public class BBDD extends SQLiteOpenHelper
  {
      private static final String KEY_ID = "id";
  
   String crear = "CREATE TABLE types(KEY_ID INTEGER PRIMARY KEY," +
                                              "value TEXT) ";
  
  
      public BBDD (Context contexto, String nombre, CursorFactory factory,
                   int version)
      {
          super(contexto, nombre, factory, version);
      }
  
      public void onCreate (SQLiteDatabase db)
      {
          db.execSQL(crear);
      }
  
      public void onUpgrade (SQLiteDatabase db, int versionAnt, int versionNue)
      {
          db.execSQL("DROP TABLE IF EXISTS types");
          db.execSQL(crear);
  
      }
  </code></pre>
  
  <p><strong>Why not works <code>DROP TABLE IF EXITS</code>?</strong></p>
  
  <p>Any suggestions?</p>
  
  <p><strong>EDIT (ON ACTIVITY I CALL BBDD.JAVA)</strong></p>
  
  <pre><code>//declare
  public BBDD types;
  //.........
  
  try
     {
                              JSONObject jresponse = new JSONObject(responseBody);
  
                              Map&lt;String, String&gt; types = new HashMap&lt;String, String&gt;();
  
                              Iterator&lt;String&gt; iterator = jresponse.keys();
                              while (iterator.hasNext())
                              {
                                  String idType = iterator.next();
                                  String nametype = (String) jresponse.get(idType);
  
                                  tipos.put(idType, nametype );
  
                                  //save on database
                                  types = new BBDD(SplashScreen.this, "BBDD", null, 1);
                                  SQLiteDatabase db= types.getWritableDatabase();
  
                                  registro = new ContentValues();
                                  registro.put("KEY_ID", idType);
                                  registro.put("value", nametype );
  
                                  if (db.insert("types", null, registro) != -1)
                                  {
  
                                      db.close();
                                  }
                                  else
                                  {
  
                                  }
                              }
  
  
                          } catch (JSONException e)
                          {
                              // TODO Auto-generated catch block
                              e.printStackTrace();
                          }
  </code></pre>