This file contains hidden or 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
public class WeatherProvider extends ContentProvider { | |
@Override | |
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { | |
// Here's the switch statement that, given a URI, will determine what kind of request it is, and query the database accordingly. | |
Cursor retCursor; | |
switch (sUriMatcher.match(uri)) { | |
// "weather/*/*" | |
case WEATHER_WITH_LOCATION_AND_DATE: { | |
retCursor = getWeatherByLocationSettingAndDate(uri, projection, sortOrder); | |
break; |
This file contains hidden or 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
public class WeatherProvider extends ContentProvider { | |
// The URI Matcher used by this content provider. | |
private static final UriMatcher sUriMatcher = buildUriMatcher(); | |
static UriMatcher buildUriMatcher() { | |
final UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH); | |
final String authority = WeatherContract.CONTENT_AUTHORITY; | |
uriMatcher.addURI(authority, WeatherContract.PATH_WEATHER, WEATHER); | |
uriMatcher.addURI(authority, WeatherContract.PATH_WEATHER + "/*", WEATHER_WITH_LOCATION); |
This file contains hidden or 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
public class WeatherProvider extends ContentProvider { | |
... | |
static final int WEATHER = 100; | |
static final int WEATHER_WITH_LOCATION = 101; | |
static final int WEATHER_WITH_LOCATION_AND_DATE = 102; | |
static final int LOCATION = 300; | |
... | |
} |
This file contains hidden or 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.sunshine.app.data; | |
import android.content.ContentValues; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.test.AndroidTestCase; | |
import java.util.HashSet; | |
public class TestDb extends AndroidTestCase { |
This file contains hidden or 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.sunshine.app.data; | |
//imports... | |
/** Manages a local database for weather data. */ | |
public class WeatherDbHelper extends SQLiteOpenHelper { | |
// If you change the database schema, you must increment the database version. | |
private static final int DATABASE_VERSION = 2; |
This file contains hidden or 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.sunshine.app.data; | |
import android.content.ContentResolver; | |
import android.content.ContentUris; | |
import android.net.Uri; | |
import android.provider.BaseColumns; | |
import android.text.format.Time; | |
/** Defines table and column names for the weather database. */ | |
public class WeatherContract { |
This file contains hidden or 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 android.example.com.dictionaryproviderexample; | |
import android.content.ContentResolver; | |
import android.database.Cursor; | |
import android.os.Bundle; | |
import android.provider.UserDictionary; | |
import android.support.v7.app.ActionBarActivity; | |
import android.widget.ListView; | |
import android.widget.SimpleCursorAdapter; |
This file contains hidden or 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 android.example.com.dictionaryproviderexample; | |
import android.content.ContentResolver; | |
import android.database.Cursor; | |
import android.os.Bundle; | |
import android.provider.UserDictionary; | |
import android.provider.UserDictionary.Words; | |
import android.support.v7.app.ActionBarActivity; | |
import android.widget.TextView; |
This file contains hidden or 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 algorithms.easy; | |
import static org.junit.Assert.assertEquals; | |
import org.junit.Test; | |
public class TemplateTest { | |
@Test | |
public void changedLettersInput01(){ | |
MarsExploration marsExploration = new MarsExploration("SOSSPSSQSSOR"); |
This file contains hidden or 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 mypackage; | |
import java.io.*; | |
import java.util.*; | |
public class ThisClassName { | |
public static void main(String[] args) throws IOException { | |
InputStream inputStream = ThisClassName.class.getClassLoader().getResourceAsStream("config.properties"); | |
Properties properties = new Properties(); | |
properties.load(inputStream); |