get Root View - Android User Interface

Android examples for User Interface:View Property

Description

get Root View

Demo Code


//package com.java2s;
import android.app.Activity;
import android.content.Context;
import android.view.View;

public class Main {
    public static View getRootView(Context context) {
        return ((Activity) context).getWindow().getDecorView()
                .findViewById(android.R.id.content);
    }/*from w  w  w.ja  va  2 s .c  o m*/
}

Related Tutorials