Error while installing the app.
Error--"android.content.res.Resources$NotFoundException: Resource ID
0xffffffff"
Please help..
int viewType = getItemViewType(cursor.getPosition());
switch (viewType) {
case VIEW_TYPE_TODAY: {
// Get weather icon
viewHolder.iconView.setImageResource(Utility.getArtResourceForWeatherCondition(
cursor.getInt(ForecastFragment.COL_WEATHER_CONDITION_ID)));
break;
}
case VIEW_TYPE_FUTURE_DAY: {
// Get weather icon
viewHolder.iconView.setImageResource(Utility.getIconResourceForWeatherCondition (
cursor.getInt(ForecastFragment.COL_WEATHER_CONDITION_ID)));
break;
}
}
You are trying to give -1 in getString() function or while accessing some resource
EDIT: After reviewing your github code, I got the reason of crash that
Utility.getIconResourceForWeatherCondition(cursor.getInt(ForecastFragment.COL_WEATHER_CONDITION_ID))
this Utility method, returns -1 in a case where
cursor.getInt(ForecastFragment.COL_WEATHER_CONDITION_ID)
this returns, 904
and 904 is not listed in any if-else conditions of Utility function, hence the last return
statement returns -1
. I guess, either there is an unintended entry in database or some conditions are missing in Utility function, or there is a third option that you return some default drawable instead of -1
from the last return statement.
Hope it solves your problem.
User contributions licensed under CC BY-SA 3.0