Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android.content.res.Resources$NotFoundException: Resource ID #0x0 #293

Closed
barbeau opened this issue Sep 18, 2015 · 1 comment
Closed

android.content.res.Resources$NotFoundException: Resource ID #0x0 #293

barbeau opened this issue Sep 18, 2015 · 1 comment
Labels

Comments

@barbeau
Copy link
Member

barbeau commented Sep 18, 2015

For develop branch:

Occasionally when I go back to the app and it resumes, it crashes and I see this exception:

android.content.res.Resources$NotFoundException: Resource ID #0x0
            at android.content.res.Resources.getValue(Resources.java:1316)
            at android.content.res.Resources.getDrawable(Resources.java:812)
            at android.content.Context.getDrawable(Context.java:403)
            at android.support.v4.content.ContextCompatApi21.getDrawable(ContextCompatApi21.java:26)
            at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:319)
            at org.onebusaway.android.ui.AlertList$Adapter.initView(AlertList.java:78)
            at org.onebusaway.android.ui.AlertList$Adapter.initView(AlertList.java:60)
            at org.onebusaway.android.util.ArrayAdapter.getView(ArrayAdapter.java:73)
            at android.widget.AbsListView.obtainView(AbsListView.java:2390)
            at android.widget.ListView.measureHeightOfChildren(ListView.java:1270)
            at android.widget.ListView.onMeasure(ListView.java:1182)

Looks like its caused by this code getting the drawable for the AlertList:

int drawableRight = clickable ? R.drawable.ic_navigation_chevron_right : 0;
int iconColor = R.color.header_text_color;
Drawable drawable = ContextCompat
                    .getDrawable(Application.get().getApplicationContext(), drawableRight);  // <- This line throws the exception
Drawable wrappedDrawable = DrawableCompat.wrap(drawable);
wrappedDrawable = wrappedDrawable.mutate();
@barbeau barbeau added the bug label Sep 18, 2015
barbeau added a commit that referenced this issue Sep 18, 2015
…source ID

Currently, we're calling ContextCompat.getDrawable() with the value of 0 when its not clickable, which causes the `android.content.res.Resources$NotFoundException: Resource ID #0x0` exception
@barbeau
Copy link
Member Author

barbeau commented Sep 18, 2015

Fixed in develop via 40540cd.

@barbeau barbeau closed this as completed Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant