Warum wird der folgende Code in einem statischen Block platziert?Beim Anwenden des inneren Joins in der SQLiteQueryBuilder-Klasse
private static final SQLiteQueryBuilder sWeatherByLocationSettingQueryBuilder;
//static block:
static{
sWeatherByLocationSettingQueryBuilder = new SQLiteQueryBuilder();
//This is an inner join which looks like
//weather INNER JOIN location ON weather.location_id = location._id
sWeatherByLocationSettingQueryBuilder.setTables(
WeatherContract.WeatherEntry.TABLE_NAME + " INNER JOIN " +
WeatherContract.LocationEntry.TABLE_NAME +
" ON " + WeatherContract.WeatherEntry.TABLE_NAME +
"." + WeatherContract.WeatherEntry.COLUMN_LOC_KEY +
" = " + WeatherContract.LocationEntry.TABLE_NAME +
"." + WeatherContract.LocationEntry._ID);
}
Unklar, was Sie fordern. Könnten Sie Ihrer Frage einen Kontext geben? –
http://stackoverflow.com/questions/2943556/static-block-in-java – Krish