09-12-2009 04:26 PM
I'm getting some user who use custom themes. Their theme is black and I use some black images, so the images are not visible. Is there a way to ensure a white background to all screens in my app?
Solved! Go to Solution.
09-12-2009 08:39 PM - edited 09-12-2009 08:41 PM
This is a common complaint. Once you paint ANYTHING, you run into the possibility of getting stepped on by the theme, unless you paint EVERYTHING.
The real problem here is not so much the theme, as the lack of any API for the app to detect and/or use the theme colors.
One "work-around" is to override the undocumented method "applyTheme" in your screen components (just an empty method). This should defeat the theme colors on your screen.
Signature for that method is
protected void applyTheme()
09-13-2009 08:25 AM
09-13-2009 10:38 AM
Thanks RexDoug. I think the issue is that this user's theme (Ulterior BlackBerry Storm Theme) modifies the default background for all Apps to black. I've tried to find other themes with the same behaviour but everything else seems to leave the default background alone. I've purchased the offending theme, but can't get it to load on my storm simualtor (invalid cod files). I think your solution will probably work, I just need to first reproduce the problem by finding a theme that modifies the background of all apps. The good news is that changing background colours does not seem to be a widespread habit of theme creators (which unfortunately makes reprodction hard). Why anyone would make such a theme is baffling and why RIM allows this behavour is stranger still.
Once I find another equally irritating theme and reproduce and verify, I'll report back and hopefully mark your post as the solution.
09-13-2009 11:29 AM
In my experience, you can defeat the theme background by using FullScreen and setting the background yourself.
The issue is that you have to provide some the the "free stuff" you get with MainScreen, like a build-in VerticalFieldManager, etc.
Make sure you select the DEFAULT_MENU style in your constructor if you need the default system menu items.
09-13-2009 11:45 AM
I think I can do that with a mainscreen subclass as well.
as per this KB article:
That is a different solutuion than defeating the theme by overrding applyTheme()
on 4.6 and above putting this in the constructor of the mainScreen child works fine:
_manager = (VerticalFieldManager)getMainManager();
Background bg = BackgroundFactory.createSolidBackground(Color.WHIT
The paint() override method described in the KB article for 4.5 and below didn't work so well.
I like your "applyTheme()" approach as it seems more flexible as to work on all devices and all O.S. 4.2 and up - and it probaby works - it is just that I can't find a theme that changes the default background for all apps to test it.
09-13-2009 11:55 AM
I found another theme to test against and your solution works perfectly!!
In my mainScreen derived class, I put
protected void applyTheme()
and it defeats the theme's attempts to paint the background.
Thanks again RexDoug!!