I have a XML file that I set up to tell the app what image to use as the splash screen. However, I have multiple images that can be used depending on the screen size. I have the following code to determine the screen size:
Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); Note: I'm using getWidth and getHeight because my app is using API 7. I do know that they were deprecated later on.
Anyways, here is what I have in my XML file:
<?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.Splash" parent="android:Theme"> <item name="android:windowBackground">@drawable/splash_screen</item> <item name="android:windowNoTitle">true</item> </style> </resources> Basically, what I want to be able to do is be able to programmatically change splash_screen to whatever the name of my file is depending on the screen size. Any ideas how I can change the XML file from my code?
Thanks in advance for any help given.