Reputation: 1914
I created a class that inherits from SurfaceView. I would like to pass an argument to its constructor while calling findViewById(). Is it possible? How? How to handle it if not?
this.surfaceView = (TubeSurfaceView) findViewById(R.id.surfaceView);
Thank you.
Upvotes: 1
Views: 2481
Reputation: 93561
Nope. findViewById is used on already instantiated views to find already instantiated children. Either you need to create the surface view programatically (in which case you wouldn't need to call findViewById), or you need to make whatever you want to pass via constructor an xml parameter.
Upvotes: 5