Hello! My code is working and so, but I don't understand one thing. I've started game programming and now works my whole SurfaceView and so on. I have draw a background so it all works.
When I created this I followed a tutorial, so know I'm commenting on my own language. :) When I now started to comment some things; I can't get rid of this, can someone tell me why my constructor for my view has the Context parameter and AttributeSet paramater? What makes it necessary to have these and why do I need to set the localContext value to my GameView context?
Game
public class Game extends Activity{
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(new GameView(this, null));
}
}
GameView
public GameView(Context localContext, AttributeSet attrSet){
super(localContext, attrSet);
context=localContext;
InitView();
}
The InitView(); just initialize every objects and variables I created; if this stuff is needed in order to explain the constructor-thing to me; I will post it.
Thanks!