I don't have a direct answer for you. But this is what i usually do when problems baffle me. I browse the git-source of Android.
Try to find the source of SurfaceHolder and find the lockCanvas( ) and see why it may throw an exception. On Apr 3, 1:32 pm, mcmc <manni...@gmail.com> wrote: > Everytime it hits the "c = mHolder.lockCanvas();" line, it pops up > with that same error mentioned below. > > Also, I realize that c returns a null after called lockCanvas(), but > mHolder is still active. Why might this be? > > I'm getting the following error as seen from the logcat window: > > E/SurfaceComposerClient( 608): eLocked set when entering lock_layer > (), layer=1 (lcblk=0x410480a0), state=00000022 > E/SurfaceHolder( 608): Exception locking surface > E/SurfaceHolder( 608): java.lang.IllegalArgumentException > E/SurfaceHolder( 608): at > android.view.Surface.lockCanvasNative(Native Method) > E/SurfaceHolder( 608): at android.view.Surface.lockCanvas > (Surface.java:190) > E/SurfaceHolder( 608): at android.view.SurfaceView > $2.internalLockCanvas(SurfaceView.java:549) > E/SurfaceHolder( 608): at android.view.SurfaceView > $2.lockCanvas(SurfaceView.java:528) > > This is the basis of my code, which is primarily based on the > lunarview: > > @Override > public void run() { > while (mRun) { > Canvas c = null; > try { > mHolder = getHolder(); //make sure holder is updated > c = mHolder.lockCanvas(); > synchronized (mHolder) { > if (mMode == STATE_RUNNING && c != null){ > doDraw(c); > } > } > } finally { > // do this in a finally so that if an exception is thrown > // during the above, we don't leave the Surface in an > // inconsistent state > if (c != null) { > mHolder.unlockCanvasAndPost(c); > } > } > } > > } > > Can someone get back to me ASAP, this is urgent. > > Thanks a lot, > mcmc --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---