get Root View - Android android.app

Android examples for android.app:Window

Description

get Root View

Demo Code

import android.annotation.NonNull;
import android.app.Activity;
import android.view.View;
import android.view.Window;

public class Main{

    public static View getRootView(@NonNull final Activity activity) {
        return getWindow(activity).getDecorView().getRootView();
    }//from w w w.  j a v  a  2 s. co  m

    public static Window getWindow(@NonNull final Activity activity) {
        return activity.getWindow();
    }

}

Related Tutorials