Getting ResourceNotFoundException after device reb

2019-07-20 07:03发布

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条回答
爷的心禁止访问
2楼-- · 2019-07-20 07:27

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.

查看更多
登录 后发表回答