File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
app/src/main/java/com/simplemobiletools/flashlight Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11package com .simplemobiletools .flashlight ;
22
33import android .content .Context ;
4+ import android .graphics .SurfaceTexture ;
45import android .hardware .Camera ;
56import android .os .Handler ;
67import android .util .Log ;
78
89import com .squareup .otto .Bus ;
910
11+ import java .io .IOException ;
12+
1013public class MyCameraImpl {
1114 private static final String TAG = MyCameraImpl .class .getSimpleName ();
1215
@@ -223,6 +226,15 @@ public void run() {
223226 torchOn .setFlashMode (Camera .Parameters .FLASH_MODE_TORCH );
224227 torchOff .setFlashMode (Camera .Parameters .FLASH_MODE_OFF );
225228
229+ SurfaceTexture dummy = new SurfaceTexture (1 );
230+ try {
231+ mCamera .setPreviewTexture (dummy );
232+ } catch (IOException e ) {
233+ Log .e (TAG , "setup stroboscope1 " + e .getMessage ());
234+ }
235+
236+ mCamera .startPreview ();
237+
226238 while (!mShouldStroboscopeStop ) {
227239 try {
228240 mCamera .setParameters (torchOn );
@@ -244,8 +256,8 @@ public void run() {
244256 mCamera = null ;
245257 }
246258 }
247- } catch (RuntimeException ignored ) {
248-
259+ } catch (RuntimeException e ) {
260+ Log . e ( TAG , "setup stroboscope2 " + e . getMessage ());
249261 }
250262 }
251263
You can’t perform that action at this time.
0 commit comments