Skip to content

Instantly share code, notes, and snippets.

@ziedrebhi
Last active August 29, 2015 14:07
Show Gist options
  • Save ziedrebhi/0f570719ad21556f5e95 to your computer and use it in GitHub Desktop.
Save ziedrebhi/0f570719ad21556f5e95 to your computer and use it in GitHub Desktop.
/**
* Tuto SQLite Android
* @author Zied Rebhi
* http://www.tutozone.info
*/
public class MainActivity extends Activity {
SQLiteDatabaseHandler db;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
db = new SQLiteDatabaseHandler(this);
Food food1 = new Food(1, "Pizza", (float) 2500, 50);
Food food2 = new Food(2, "Cake", (float) 500, 20);
db.addOne(food1);
db.addOne(food2);
db.showAll();
db.deleteOne(food1);
db.showAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment