Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Application Background Image

I want to change background image of my application when user select the image from setting activity, I set the background image using theme as:

<style name="Theme" parent="@android:style/Theme">
    <item name="android:windowBackground">@drawable/sunset</item>
</style>

Now how can I change the android:windowBackground via code.

like image 584
Krishnakant Dalal Avatar asked Nov 14 '22 06:11

Krishnakant Dalal


1 Answers

From your activity, call getWindow().setBackgroundDrawable(Drawable drawable) or getWindow().setBackgroundDrawableResource(int resid).

like image 122
Gallal Avatar answered Nov 16 '22 02:11

Gallal