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

前端 未结 1 511
清歌不尽
清歌不尽 2021-01-24 16:44

This exception occurs while running a fragment trying to display a ListView of objects. I have researched the exception but the solution for other cases seems to have to do with

相关标签:
1条回答
  • 2021-01-24 16:56

    Found your error. Its in your line below in your IngAdapter

    super(context, 0, ings);
    

    In this the 2nd parameter should be the resource name and should never be hardcoded by any int value. This is the identifier of the layout which will be used for creating each row in your list. If you just want to display the list of names you can use - android.R.layout.simple_list_item_1 which is a standard available in android for displaying just String values.

    So change your code to

    super(context, android.R.layout.simple_list_item_1, ings);     
    
    0 讨论(0)
提交回复
热议问题