Hello community,

I'm trying to get some parameters from the XML layout to be passed to some 
instance var like this:

public class MyView extends GLSurfaceView {
    private MyRenderer mRenderer;

    public MyView(Context ctx, AttributeSet attrs) {
        super(ctx, attrs);
        init(ctx);
    }

    private void init(Context ctx) {
        mRenderer = new MyRenderer(ctx);
        setRenderer(mRenderer);
    }

    @Override
    public void setBackground(Drawable background) {
        mRenderer.setBackground(background);
    }}

To my knowledge setBackground is called before init, so mRenderer has not 
been initialized yet. It seems like a catch 22.

Is there some pattern I can use to get stuff initialized that depends on 
the view's parameters?

Best regards.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/c71780a5-9afe-423c-b3c0-01afff786624%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to