@OnClick(R.id.btnSave) public void saveClicked(View v) { City newCity = new City(etCity.getText().toString(), new Date(System.currentTimeMillis()).toString()); newCity.save(); refreshList(); }
private void refreshList() { List<City> cities = City.listAll(City.class); tvData.setText(""); for (City city : cities) { tvData.append(city.getCityName() + ", " + city.getDateAdded() + "\n"); } }
@OnClick(R.id.btnDeleteAll) public void deleteAll(View v) { City.deleteAll(City.class); refreshList(); }