android - How to check is device camera enabled? -


is there way check is(/are) device camera(s) enabled ? if yes, should ?

if enabled, mean open or in use, yes, there way.

camera.open() give exception if camera in use.

so can make use of check if camera enabled, in use or if there camera.

/** how camera object savely */ public static camera getcamerainstance(){     camera c = null;     try {         c = camera.open(); // try camera     }     catch (exception e){         // camera not available (in use) or not exist     }     return c; // null returned if unavailable, or non existent } 

if camera in use want use it, call

camera.release(); 

and use yourself.


Comments

Popular posts from this blog

mod rewrite - Using "?" when rewriting the URL -

.htaccess: Transfer name to index.php if not directory public -

Admob integration with pygame in android -