set Activity Background Color - Android Activity

Android examples for Activity:Activity Background

Description

set Activity Background Color

Demo Code


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

import android.graphics.drawable.ColorDrawable;

public class Main {
    public static void setBackgroundColor(Context context,
            Activity activity, int color) {
        activity.getWindow()// w ww. j  ava2s.c  om
                .getDecorView()
                .setBackground(
                        new ColorDrawable(context.getResources().getColor(
                                color)));
    }
}

Related Tutorials