Google Android Building A Camera App Tutorial -


i'm going through 'building camera app' tutorial -http://developer.android.com/guide/topics/media/camera.html#custom-camera

as relatively new android, find bit confusing / unclear @ times.

i'm trying understand code supposed go:

private boolean isrecording = false;  // add listener capture button button capturebutton = (button) findviewbyid(id.button_capture); capturebutton.setonclicklistener( new view.onclicklistener() {     @override     public void onclick(view v) {         if (isrecording) {             // stop recording , release camera             mmediarecorder.stop();  // stop recording             releasemediarecorder(); // release mediarecorder object             mcamera.lock();         // take camera access mediarecorder              // inform user recording has stopped             setcapturebuttontext("capture");             isrecording = false;         } else {             // initialize video camera             if (preparevideorecorder()) {                 // camera available , unlocked, mediarecorder prepared,                 // can start recording                 mmediarecorder.start();                  // inform user recording has started                 setcapturebuttontext("stop");                 isrecording = true;             } else {                 // prepare didn't work, release camera                 releasemediarecorder();                 // inform user             }         }     } } ); 

can anywhere within top level class, or supposed inside 1 of provided methods or inner classes?

no matter put code it's causing errors telling me add or remove '}', i'm sure must have in wrong place, since i'm sure google's code fine.

any appreciated!

this code belongs in activity loads layout containing "button_capture" button. 1 find activity, out inside of oncreate() method.

no matter put code it's causing errors telling me add or remove '}'

this matter of getting braces paired properly.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -