예제 #1
0
파일: Search.java 프로젝트: wspi/Sky-Zone
  public void CarregaLista(String searched) {
    SQLiteDatabase myDB = null;
    try {
      myDB = this.openOrCreateDatabase("skyzone", MODE_PRIVATE, null);

      Cursor mCursor =
          myDB.rawQuery("SELECT * FROM Zones WHERE Name LIKE '" + searched + "%';", null);

      startManagingCursor(mCursor);

      ListAdapter adapter =
          new SimpleCursorAdapter(
              this,
              R.layout.list,
              mCursor,
              new String[] {"Icon", "Name", "Country", "State", "City", "Phone"},
              new int[] {R.id.Icon, R.id.Name, R.id.Country, R.id.State, R.id.City, R.id.Phone});
      this.setListAdapter(adapter);

      this.getListView().setTextFilterEnabled(true);
    } finally {
      if (myDB != null) {
        myDB.close();
      }
    }
  }
예제 #2
0
 public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
   db.execSQL("DROP TABLE IF EXISTS contact");
   onCreate(db);
 }
예제 #3
0
 public void onCreate(SQLiteDatabase db) {
   db.execSQL(
       "CREATE TABLE contact ( _id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT, tel TEXT);");
 }