Open nirthik opened 7 years ago
I'm facing this issue also, I made FORECAST_COULMN public then did some refactoring in ForecastAdapter as given below
int dateInMillisIndex = cursor.getColumnIndex(ForecastFragment.FORECAST_COLUMNS[ForecastFragment.COL_WEATHER_DATE]);
long dateInMillis = cursor.getLong(dateInMillisIndex);
WeatherContract.WeatherEntry.COLUMN_LOC_KEY, is missing in FORECAST_COLUMNS columns.
In onCreateView Cursor cursor = (Cursor) adapterView.getItemAtPosition(position); the cursor returns the WeatherContract.WeatherEntry.COLUMN_LOC_KEY in second position and WeatherContract.WeatherEntry.COLUMN_DATE, in third position.
So the indices for the FORECAST_COLUMNS also need to be changed.
The following lines need to be added in ForecastFragment:
static final int COL_LOCATION_ID = 1; static final int COL_WEATHER_DATE = 2;