Why wont my ImageButton change imageresource?
<p>I'm trying update imagebuttons that I have in a gridview that exists in a compound component. I have tried several different methods but somehow I can't get i to work. Here is my code:</p>

<p>This is a class with a merged xml-layout:</p>

<pre><code>public class DialPadView extends RelativeLayout {

private GridView gv;

public DialPadView(Context context, AttributeSet attr) {
    super(context, attr);

    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    inflater.inflate(R.layout.dialpad, this, true);
    gv = (GridView)findViewById(R.id.gv_dials);
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    TableLayout tl = (TableLayout)findViewById(R.id.tl_main);
    int leftHeight = this.getHeight() - tl.getHeight();
    gv.setAdapter(new DialpadAdapter(this.getContext(), leftHeight));
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
</code></pre>

<p>}</p>

<p>The DialpadAdapters getView method looks like this:</p>

<pre><code>public View getView(int position, View convertView, ViewGroup parent) {
    DialButton imgBtn;

    if(convertView == null) {
        imgBtn = new DialButton(mContext);
        imgBtn.setLayoutParams(new GridView.LayoutParams(btnHeight, btnHeight));
        imgBtn.setScaleType(DialButton.ScaleType.FIT_CENTER);
        imgBtn.setPadding(2, 2, 2, 2);
    } else {
        imgBtn = (DialButton) convertView;
    }

    imgBtn.setImageResource(mDigitsId[position]);
    imgBtn.setBackgroundColor(color.transparent);


    imgBtn.setPosition(position);
    imgBtn.setHapticFeedbackEnabled(true);
    imgBtn.setOnTouchListener(new OnTouchListener() {
        public boolean onTouch(View v, MotionEvent event) {
            DialButton ib = (DialButton) v;
            if(event.getAction() == MotionEvent.ACTION_DOWN) {
                ib.changeImage(mDigitsOverId[ib.getPosition()]);
                ib.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
                Log.d("BUTTON PRESSED", "THIS BUTTON IS INDEED PRESSED!");
            } else {
                ib.changeImage(mDigitsId[ib.getPosition()]);
            }
            return false;
        }
    });

    return imgBtn;
}
</code></pre>

<p>And finally my DialButton is simply a extended ImageButton:</p>

<pre><code>public class DialButton extends ImageButton {

private int _position;

public DialButton(Context ctx) {
    super(ctx);
}

public void changeImage(int resource_id) {
    this.invalidate();
    this.setImageResource(resource_id);
    this.invalidate();
}


public void setPosition(int pos) {
    _position = pos;
}

public int getPosition() {
    return _position;
}
</code></pre>

<p>}</p>

<p>The log-message in the getView method prints so I know that getView gets called but somehow the images doesn't change. Please can anyone see what it is that I'm doing wrong?</p>

<p>EDIT: To clarify, I have already tried passing a resource-id directly.</p>
