Getting ResourceNotFoundException after device rebooted

最后都变了- 提交于 2019-12-11 02:35:36

问题


I am having Boot Completed Receiver in my application and after Reboot completed, inside my Boot Receiver I am starting an Activity. In that I am getting ResourceNotFoundException on setting layout.

setContentView(R.layout.activity_home);//getting error of resource not found on this line

I don't know the reason but its but obviously because it is not able to find the layout or R in my app. Anyone has any idea about this? Please kindly guide me to resolve this issue.

EDIT - I found that if I unlock the screen before my app try to load then it will not having any problem. Problem is only occurred when the emulator screen is locked and I unlock it after my app starts. So what happens it shows me the message the your app is unfortunately crashed.


回答1:


Resolved this issue. Its because in my case I am using only landscape layout in my application and I have defined all the layouts in layout-land folder. So because of that its not able to find the layout. Transferred all the layouts inside layout folder and its working now. Thank you all for your kind support.



来源:https://stackoverflow.com/questions/14118576/getting-resourcenotfoundexception-after-device-rebooted

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!