5

I was going through the GDK docs on LiveCards (high frequency) and I came across this line of code:

mLiveCard.getSurfaceHolder().addCallback(new RenderThread());

RenderThread is a Class that extends Thread and does not implement any SurfaceHolder.Callback. In the other hand, in the same sample code they define LiveCardRenderer which implements DirectRenderingCallback which in turn extends SurfaceHolder.Callback. Shouldn't LiveCardRenderer be used instead of RenderThread?

Emmanuel
  • 13,083
  • 4
  • 39
  • 53

2 Answers2

2

Thanks for catching that. You're right, it should be new LiveCardRenderer(). The documentation has now been fixed.

Tony Allevato
  • 6,429
  • 1
  • 29
  • 34
1

This does look a lot like a mistake, as you rightly say, instead of new RenderThread(), you should have new LiveCardRenderer().

If you take a look and any of the sample apps in the GDK, for example the compass app you can see they have something like

mRenderer = new CompassRenderer(this, mOrientationManager, mLandmarks);
mLiveCard.setDirectRenderingEnabled(true).getSurfaceHolder().addCallback(mRenderer);

Where CompassRenderer extends SurfaceHolder.Callback as you would expect and the code is similar in principle to that given for LiveCardRenderer.

I hope that helps.

Ben
  • 1,767
  • 16
  • 32