This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Problem in LWUIT Theme  RSS feed

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to apply a theme to my application, the application runs but it doesnt load the Theme.it displays plain white screen.I am using SkinE72 model mobile.

Please help me.

My Code:

try {
Resources r = Resources.open("/res/theme.res");
UIManager.getInstance().setThemeProps(r.getTheme("theme"));
} catch (IOException ioe) {
// Do something here.
}

I created res folder and i put theme.res file into it.but it displays white screen







 
Ranch Hand
Posts: 40
Google App Engine Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked that you get a Exception or not ?
Try Alert() or system.out in Exception.
 
vani prahalathan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i checked now that what you said.i got this error

Error:

Exception java.io.IOException: /res/theme.res not found

but i put my theme.res file into res folder..it is nearby of src folder.

using resource creator ,i created simple theme(background color for form).but it doesnt work.please help me

 
Srinath Gamage
Ranch Hand
Posts: 40
Google App Engine Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok simple issue, with the resource path and actual path.
first place it in outer level (default package ) and try using "theme.res"
 
vani prahalathan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
THIS IS MY CODE:

public void startApp() {


Display.init(this);


Form f = new Form("Hello, LWUIT!");
setTheameRes();
f.show();


Command exitCommand = new Command("Exit");
f.addCommand(exitCommand);
}
public void setTheameRes() {
try {
Resources r = Resources.open("/theme.res");
UIManager.getInstance().setThemeProps(r.getTheme("theme"));
} catch (IOException ioe) {
System.out.println("Exception "+ioe);
}
}
Error:

java.lang.NullPointerException: 0
at com.sun.lwuit.plaf.UIManager.buildTheme(UIManager.java:382)
at com.sun.lwuit.plaf.UIManager.setThemePropsImpl(UIManager.java:377)
at com.sun.lwuit.plaf.UIManager.setThemeProps(UIManager.java:353)
at pack.Simple.setTheameRes(Simple.java:44)
at pack.Simple.startApp(Simple.java:34)
at javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1
at com.sun.midp.midlet.MIDletPeer.startApp(), bci=7
at com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269
at com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
at com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
at com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
at com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26


Exception display in alert msg on mobile :The applicationhas unexpectedly quit.Contact the application provider to resolve the issue

please tell me the solution
 
Srinath Gamage
Ranch Hand
Posts: 40
Google App Engine Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try without "/" just "theme.res" .
If you can send the directory structure it's easier.
 
vani prahalathan
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried that also.but it displays white screen

Dir structure:
---------------

D:\J2ME\samplelwuit\src\theme.res


For source code:
--------------

D:\J2ME\samplelwuit\src\pack\Simple.java


can you help me for creating theme.?i am so confused.


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!