1)Which is better for developing a game --a)Using XML layouts
b)Using Custom
layouts with Surface view
2) while making a custom view using Surface view... do we need to have a
secondary thread to implement the surfaceholder.callback()......
my code below does not show the activity in grey background as i have
coded... do i need to use the unlockcanvas and all ,,but i havent used the
secondary thread
setContentView(new PlayPanel(this));
class PlayPanel extends SurfaceView implements SurfaceHolder.Callback
{
SurfaceHolder mHolder;
private boolean mHasSurface;
public PlayPanel(Context context)
{
super(context);
mHolder = getHolder();
mHolder.addCallback(this);
mHasSurface = false;
}
@Override
public void onDraw(Canvas canvas)
{
canvas.drawColor(Color.LTGRAY); ////// *GREYY BACKGROUND*
drawHeader(canvas);
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
mHasSurface = true;
//return true;
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub
mHasSurface = false;
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---