Created
July 4, 2017 20:49
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See also: Android docs