get Parent View from a View - Android User Interface

Android examples for User Interface:View Parent

Description

get Parent View from a View

Demo Code


//package com.java2s;

import android.view.View;

public class Main {
    private static View getParentView(View view) {
        if (view.getParent() instanceof View) {
            return (View) view.getParent();
        } else {//from  w w w. j  a  va  2 s .c  o m
            return view.getRootView();
        }
    }
}

Related Tutorials