import android.view.ViewGroup; ViewGroup view = (ViewGroup) this.getParent(); if (view != null) { view.removeView(this); }