ViewAttachViewpublic class ViewAttachView extends android.view.View A View that will throw a RuntimeException if onAttachedToWindow and
onDetachedFromWindow is called in the wrong order for ViewAttachTest |
Fields Summary |
---|
public static final String | TAG | private boolean | attached |
Methods Summary |
---|
private void | init(android.util.AttributeSet attrs, int defStyle)
SystemClock.sleep(2000);
| protected void | onAttachedToWindow()
Log.d(TAG, "onAttachedToWindow");
super.onAttachedToWindow();
if (attached) {
throw new RuntimeException("OnAttachedToWindow called more than once in a row");
}
attached = true;
| protected void | onDetachedFromWindow()
Log.d(TAG, "onDetachedFromWindow");
super.onDetachedFromWindow();
if (!attached) {
throw new RuntimeException(
"onDetachedFromWindowcalled without prior call to OnAttachedToWindow");
}
attached = false;
| protected void | onDraw(android.graphics.Canvas canvas)
super.onDraw(canvas);
canvas.drawColor(Color.BLUE);
|
|