PDA

View Full Version : Have anyone tried this tutorial ?



Q-ro
October 20th, 2012, 07:32 AM
Hello everyone, i'm trying to follow the tutorials for a camera app located in ; the problem is that when i try and copy paste to my project, i get an error showing there is something wrong int he following code:


public void surfaceCreated(SurfaceHolder holder) {
// The Surface has been created, now tell the camera where to draw the preview.
try {
mCamera.setPreviewDisplay(holder);
mCamera.startPreview();
} catch (IOException e) {
Log.d(TAG, "Error setting camera preview: " + e.getMessage());
}
}

the error goes something like "TAG variable is not set", but, as far as i understood, TAG is some sort of internal class/function on the Android API, so, ¿ is there something i'm missing ?.

Thanks in advance.

mevun
October 20th, 2012, 05:39 PM
I don't know about your tutorial, but your understanding of TAG is wrong.
Log.d uses the Log class which has a class function d (which stands for debug).
You pass to that function a 'tag' parameter which should be a String (or maybe a CharSequence or other similar class). Obviously, the second parameter is also a String or CharSequence.

So you can put a line higher above like
TAG = "myApp";

Q-ro
October 20th, 2012, 06:33 PM
oh i'm sorry about the tutorial site, i'm adding the address :

http://developer.android.com/guide/topics/media/camera.html#custom-camera

As for TAG, ¿so what you are saying is that TAG should be a string in my string.xml ?

Parker32
November 12th, 2012, 08:17 AM
I don't know about this and never used it before.

shahrulbig5
November 28th, 2012, 03:38 PM
am never tried it before... haha.. :D

(http://voolow.blogspot.com/2012/01/tips-sukses-interview-melamar-kerja.html)
http://4.bp.blogspot.com/-LcopHOItIHA/UFBUJQZQLbI/AAAAAAAAB6k/29dpyIsXRUg/s400/voolow%2Blogoo%2Brgb%2B%2528FILEminimizer%2529.jpg (http://voolow.blogspot.com/2011/12/ciri-ciri-anak-gaul-versi-tahun-2011.html)