File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/in/omerjerk/processing/video/android Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -14,11 +14,15 @@ public class Capture extends PImage implements PConstants {
14
14
15
15
private static Context context ;
16
16
17
- private static ArrayList <String > camerasList ;
17
+ private static ArrayList <String > camerasList = new ArrayList <>() ;
18
18
19
19
private static final String KEY_FRONT_CAMERA = "front-camera-%d" ;
20
20
private static final String KEY_BACK_CAMERA = "back-camera-%d" ;
21
21
22
+ public Capture (PApplet context ) {
23
+ Capture .context = context ;
24
+ }
25
+
22
26
public static String [] list () {
23
27
ensureContext ();
24
28
if (context .getPackageManager ().hasSystemFeature (PackageManager .FEATURE_CAMERA )) {
@@ -42,10 +46,7 @@ public static String[] list() {
42
46
43
47
private static void ensureContext () {
44
48
if (context == null ) {
45
- context = PApplet .getInstance ();
46
- if (context == null ) {
47
- throw new NullPointerException ("null context" );
48
- }
49
+ throw new RuntimeException ("Create the instance of Capture class first." );
49
50
}
50
51
}
51
52
}
You can’t perform that action at this time.
0 commit comments