Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in LWUIT Theme

 
vani prahalathan
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







 
Srinath Gamage
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.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic