2

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.

Scorpion
  • 6,831
  • 16
  • 75
  • 123
  • But how can i clean the project after reboot? I am running my project after cleaning it and when it runs successfully I am closing the emulator and again starting the emulator. First when i launch it normally it does not create any problem. Problem is after reboot and when I am trying to start my Activity from my Boot Receiver which i defined to get the BOOT COMPLETED event. – Scorpion Jan 02 '13 at 08:01
  • @Scorpion I think Arash thought that you had a compile error, but yours seems to be at runtime; right? – quinestor Jan 02 '13 at 13:01
  • @quinestor, Yes. I am getting error in Runtime. And I also edited my question that it works if I unlock the screen. Any idea about this? – Scorpion Jan 02 '13 at 13:08

1 Answers1

0

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.

Scorpion
  • 6,831
  • 16
  • 75
  • 123