0

I am doing a project releated to livewallpaper, my app requirement is when the user Click the button camera preview set as wallpaper. i am doing all this stuff, but problem is after set the camera preview as wallpaper, when try to open the camera, it shows camera failed, i know we create only one camera object at a time, but problem was how to release the camera berfore the user use the camera in other applications and how to start camera preview in wallpaper after user close the camera application dynamically. can any one give me an idea how can i do that?

Somanadh
  • 97
  • 2
  • 11

2 Answers2

0

You *should immediately release the camera when you don't need it anymore, maybe as soon as the new wallpaper is set. But you must release the camera when your activity looses focus.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • Thanks for reply, my problem is i am using wallpaper service to set the camera as wallpaper, it is continuous process, i was completed this step. but problem begins,when the user open the camera how would it know release the camera, then after closing the camera how would it know set the camera as wallpapaer – Somanadh Jan 06 '14 at 06:27
0

I am override the onVisibilityChanged(boolean visible) change method in Engine class to solve the issue.

public void onVisibilityChanged(boolean visible) {
    // TODO Auto-generated method stub
    super.onVisibilityChanged(visible);
    if (visible) {
        try {
             "OPEN THE CAMERA OBJECT"
        }catch(Exception e){
             e.printStackTrace();
        }
    }
    else {
         try {
             //release the camera obj
         }catch (RuntimeException e) {
             // TODO Auto-generated catch block
             e.printStackTrace();
         }
    }
}
Somanadh
  • 97
  • 2
  • 11