您好,我在我的适配器代码中得到了一个Resourcesnotfoundexception。
代码:
public class Bag_adapter extends ArrayAdapter<Data> implements Filterable {
//in getview()
{
try {
int i = getContext().getResources()
.getIdentifier(name().toLowerCase(), "drawable", getContext().getPackageName());
Log.wtf("Called", "Drawable=" + i);
holder.icon.setImageResource(i);
} catch (Exception e) {
Log.wtf("Called", "Error=" + e);
}
}下面是错误日志:
08-20 19:58:24.732 12650-12650/com.bot.pokego A/Called: Drawable=android.content.res.Resources$NotFoundException: Resource ID #0x7f0200bf
08-20 19:58:24.786 12650-12650/com.bot.pokego A/Called: Drawable=2130837716我尝试清理,删除构建文件夹also........but仍然相同的错误。
我使用的是Android Studio。
任何帮助都将不胜感激!
谢谢!inadvance :)。
发布于 2017-10-26 18:14:43
检查你的资源文件夹。如果您将资源保存在较高版本的文件夹v21中,并在较低版本上进行测试,则可能会出现此异常。
希望它能有所帮助!
https://stackoverflow.com/questions/39055235
复制相似问题