Skip to content

Instantly share code, notes, and snippets.

@jensgreiner
Created July 4, 2017 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jensgreiner/5b22471cd3b71c129de1e0a643883913 to your computer and use it in GitHub Desktop.
Save jensgreiner/5b22471cd3b71c129de1e0a643883913 to your computer and use it in GitHub Desktop.
Contract class for pets database to define tables and constants used with the database (sqlite)
package com.example.android.pets.data;
import android.provider.BaseColumns;
/**
* Contract class for pets database
* Created by Jens Greiner on 04.07.17.
*/
public final class PetContract {
private PetContract() {
// intentionally left blank to prevent others from instantiating the contract class
}
/* Inner class that defines the table contents */
public static class PetEntry implements BaseColumns {
public static final String TABLE_NAME = "pets";
public static final String _ID = BaseColumns._ID;
public static final String COLUMN_NAME = "name";
public static final String COLUMN_BREED = "breed";
public static final String COLUMN_GENDER = "gender";
public static final String COLUMN_WEIGHT = "weight";
/**
* Possible values for the gender of the pet
*/
public static final int GENDER_UNKNOWN = 0;
public static final int GENDER_MALE = 1;
public static final int GENDER_FEMALE = 2;
}
}
@jensgreiner
Copy link
Author

See also: Android docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment