Upload
search009
View
214
Download
0
Embed Size (px)
DESCRIPTION
hay
Citation preview
signup login tour help stackoverflowcareers
Takethe2minutetour StackOverflowisaquestionandanswersiteforprofessionalandenthusiastprogrammers.It's100%free,noregistrationrequired.
Android4.4:CameraFlashlightblinksonlyfewnumberoftimes
Ihavelookedintoothercameraflashlightrelatedproblemsinstackoverflow,butcouldn'tfindananswerthatsolvesmyissue.Theflashlightflashesfor68timesandthentheappcrashes.HereIhavea methodthatcalls and inaloop.CouldyoupleaseletmeknowwhereIwentwrong?Mycodecanbefoundhere: Thelogcatoutputcanbeseehere:
blink() cameraon() cameraoff()http://pastebin.com/3LRMwd1J
http://pastebin.com/2GTpn8Ux
Ihavetriedusingsurfacetextures,triedtoinclude inbetween and butsofarnoluck.Thread.sleep() cameraon() cameraoff()
IuseAndroid4.4withlatestsdkandjdkversions.Iusenexus5fortesting.
Thanksinadvance!
android flashlight
editedJul30'14at13:51 askedJul30'14at13:19user38915541 1
Pleasepostyourcodeinyourquestionaswell,someareunabletogettopastebinduetoproxies JBiresJul30'14at13:52
3Answers
Seeifmycodehelpsany:https://github.com/wolfhorse/SimpleFlashlight
Itdoesn'tblinkbutitmaybeagoodreferenceforyou.
ImodifiedtheonClick()eventofthetogglebuttonintheSimpleFlashlightappreferencedabovebyaddingthecodebelowanditblinks/flashesfineonmySamsungGalaxyS5withouterror.
EDIT:
Threadthread=newThread(newRunnable(){
@Overridepublicvoidrun(){booleanflashOn=false;for(inti=0;i