A: 

It's a bit of hack but you could store the resource IDs of the drawables in your widget. So on your widget have some code like:

private int mMiddleButtonImage;

public void setMiddleButtonImage(int resourceId) {
    mMiddleButtonImage = resourceId;
    getMiddleButton().setImageResource(resourceId);
}

The getState() and restoreState() method could then use the integer resource IDs rather than the drawables themselves.

Dave Webb
Yeah. Though consumers also need to call things like `setEnabled()` on the buttons, which was why I mentioned returning a wrapped version of `ImageButton`, rather than relying on users to call a specific method on the widget for setting the button image. The wrapped `ImageButton` would have a method like yours to capture the values for save/restore.
Christopher
@Christopher - You did suggest my answer in your question; sorry that I missed that first time I read it. I think this method will be preferable as storing int IDs will be much quicker than parcelling or serializing a Drawable, which may not be possible. commonsguy also mentioned in another post that Bitmaps are handled in some special way in the Android memory model so I think leaving them alone and just remembering the IDs will be best.
Dave Webb