Skip to content

Instantly share code, notes, and snippets.

@udacityandroid
Created July 26, 2016 22:13
Show Gist options
  • Select an option

  • Save udacityandroid/ae83549fb0599bbdbb25ac179415b83c to your computer and use it in GitHub Desktop.

Select an option

Save udacityandroid/ae83549fb0599bbdbb25ac179415b83c to your computer and use it in GitHub Desktop.
Example contract class for a table which contains data about the store's headphones stock
public final class StoreContract {
public static abstract class HeadphoneEntry implements BaseColumns {
public static final String TABLE_NAME = "headphones";
public static final String COLUMN_NAME = "name";
public static final String COLUMN_PRICE = "price";
public static final String COLUMN_STYLE = "style";
public static final String COLUMN_IN_STOCK = "in_stock";
public static final String COLUMN_DESCRIPTION = "description";
/**
* Possible values for the style of the headphone.
*/
public static final int STYLE_EAR_BUD = 0;
public static final int STYLE_ON_EAR = 1;
public static final int STYLE_OVER_EAR = 2;
public static final int STYLE_BONE_CONDUCTION = 3;
}
}
@CherifD

CherifD commented May 13, 2018

Copy link
Copy Markdown

I was wondering about the same thing. I found that it's an interface (see its code below) that has no methods. It just has two public constants: _ID and _COUNT.

==================================

ย  | * Copyright (C) 2006 The Android Open Source Project
ย  | *
ย  | * Licensed under the Apache License, Version 2.0 (the "License");
ย  | * you may not use this file except in compliance with the License.
ย  | * You may obtain a copy of the License at
ย  | *
ย  | * http://www.apache.org/licenses/LICENSE-2.0
ย  | *
ย  | * Unless required by applicable law or agreed to in writing, software
ย  | * distributed under the License is distributed on an "AS IS" BASIS,
ย  | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ย  | * See the License for the specific language governing permissions and
ย  | * limitations under the License.
ย  | */
package android.provider;

ย  public interface BaseColumns {
ย  /**
ย  * The unique ID for a row.
ย  *

Type: INTEGER (long)


ย  /
ย  public static final String _ID = "_id";
ย 
ย  /
*
ย  * The count of rows in a directory.
ย  *

Type: INTEGER


ย  */
ย  public static final String _COUNT = "_count";
ย  }

==================================

@Babadzhanov

Copy link
Copy Markdown

24th to comment on 24th of May :)) Niceee

@yucoz

yucoz commented Jun 12, 2018

Copy link
Copy Markdown

25th comment! ๐Ÿ‘

@Joffrey2378

Copy link
Copy Markdown

26th and I'm going to be 26 this month! Niiice =)

@EdgarasIljinas

Copy link
Copy Markdown

xd...

@pranjalg2308

Copy link
Copy Markdown

28th comment

@barmgeat

Copy link
Copy Markdown

29 ๐Ÿ’ƒ

@Yosolita1978

Copy link
Copy Markdown

30 is a nice number!!

@orabymahmoud

Copy link
Copy Markdown

31

@biddlecom

Copy link
Copy Markdown

well, well, 32... how are you??? ;)

@Soufiane-Aou

Copy link
Copy Markdown

33 yes yes

@casualcoder404

Copy link
Copy Markdown

I don't see any point in posting comment rank,,, I'm 34th btw ;)

@MamboBryan

Copy link
Copy Markdown

35th person

@vicky-dx

vicky-dx commented Nov 6, 2019

Copy link
Copy Markdown

incase if you curious ...i'm 36th person

@shaheer9856

Copy link
Copy Markdown

I am 37.... and I owns a McLaren ! :P

@rajhritik

Copy link
Copy Markdown

First in 2020
My name is Mr. 38.

@TimzOwen

Copy link
Copy Markdown

wouw 87

@kerolsafififawzy

Copy link
Copy Markdown

i love udacity

@DEVBRATDUBEY

Copy link
Copy Markdown

me 41 comment

@khushey

khushey commented Jul 4, 2020

Copy link
Copy Markdown

"You are my forty years old son who still lives with me."
"FORTY TWO. I AM FORTY TWO YEARS OLD."

@massil30

Copy link
Copy Markdown

52 c

@SheryTariq

Copy link
Copy Markdown

comment date/2

@vasut02

vasut02 commented Nov 30, 2020

Copy link
Copy Markdown

54th comment ๐Ÿ˜๐Ÿ˜‚

@rahulkr25

Copy link
Copy Markdown

55th #first in 2021

@willeswa

Copy link
Copy Markdown

56th comment

@david-read-iii

Copy link
Copy Markdown

57 โ˜œ(๏พŸใƒฎ๏พŸโ˜œ)

@rishikesh953

Copy link
Copy Markdown

58th comment

@Narayan-Dhingra

Copy link
Copy Markdown

59

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