×

Discussion Board

Results 1 to 14 of 14
  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Issue in loading images into command in lwuit for nokia s40

    Hi friends,

    I am trying attach an image into my command s on a form in lwuit for nokia s40 but i cant see them with the name of the command

    i am using the Constructor new Command("DemoCommand","/rahul.png").

    This issue is with lwuit for nokia s40 only it works fine with normal lwuit.

    Regards rahul

  2. #2
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    issue in using a background image for a form in lwuit for series 40

    Hi friends,

    I am using a background image for a form in lwuit for series 40.it works fine with LWUIT-for-Series-40-0.8.1-beta.but for the versions after it it doesnt show any background image its showing blank can any on solve this issue .please do help really help needed

    Regards rahul

  3. #3
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: Issue in loading images into command in lwuit for nokia s40

    i even used setdefaultCommand() but it shows icon for only one command but i need to show icons for all the commands

  4. #4
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: issue in using a background image for a form in lwuit for series 40

    Hi Rahul. Posting your code could help others help you.
    -CarlosDL

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: issue in using a background image for a form in lwuit for series 40

    I am using the below code to display background image.

    currentForm.getStyle().setBgImage("/bg_image.png");

  6. #6
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: Issue in loading images into command in lwuit for nokia s40

    hi guys please help me out i am in a real urjent. i want to set an icon to multiple commands in the same form

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,738

    Re: Issue in loading images into command in lwuit for nokia s40

    Merged the threads, as my current impression is that it is a single issue about accessing the images. First of all make sure they are really present in the package.
    Honestly said I can not decode the call itself, with this "/xy.png" argument. I do not code for mobile Java, but whatever documentation and examples I see, they expect/pass an Image as argument to these methods, and use Resources.getImage("xy.png") or Image.createImage("/xy.png") for getting that.

  8. #8
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: Issue in loading images into command in lwuit for nokia s40

    hi ,

    i have tried everything using resourse.getimage("uu"); also..the thing it works fine in default emulators using normal lwuit..but using lwuit for s40 it has some issue i cant add images to my commands..this issue is with only lwuit for s40...

  9. #9
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: Issue in loading images into command in lwuit for nokia s40

    Just an absurd idea, but have you tried the three parameter constructor, the one with that ID? Or with the set…Icon methods?
    Another option to check: oneOfYourCommandInstances.getClass().getResourceAsStream("uu") is it null?

  10. #10
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: Issue in loading images into command in lwuit for nokia s40

    yea i tried the 3 parameter constructor also.. and the method u told doesnt return a null..the thing is that only the icon of the last command added is displayed that to as a action command to the right of the screen and all other icons are not displayed.i tried everything working on it from past 2 days please help me out i am going out of my mind...

  11. #11
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: Issue in loading images into command in lwuit for nokia s40

    Can you replicate this behavior in other applications.

    Since you have not got a solution yet, I think it could be worth creating a small application showing the issue and posting the complete code here, so it is easier for others to try the code and test other options.

    Just a thought.
    -CarlosDL

  12. #12
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: Issue in loading images into command in lwuit for nokia s40

    import com.sun.lwuit.Command;
    import com.sun.lwuit.Display;
    import com.sun.lwuit.Form;
    import com.sun.lwuit.Image;
    import com.sun.lwuit.Label;
    import com.sun.lwuit.events.ActionEvent;
    import com.sun.lwuit.events.ActionListener;
    import com.sun.lwuit.layouts.BorderLayout;
    import com.sun.lwuit.util.Resources;

    import java.io.IOException;
    import javax.microedition.midlet.*;


    public class DemoUI extends MIDlet implements ActionListener{

    Label centerLabel;
    public void startApp() {
    Display.init(this);
    Form f = new Form("My LWUIT Demo");
    f.setLayout(new BorderLayout());

    Image img = null;
    Image imgSave = null;
    Image imgEdit = null;
    Resources r = null;
    try {
    r = Resources.open("/rahul.res");
    // helpCommand = new Command("Help",r.getImage("help_normal"),1);
    // helpCommand.setPressedIcon(r.getImage("help_pressed"));
    // settingsCommand = new Command("Settings",r.getImage("setting_normal"),2);
    // settingsCommand.setPressedIcon(r.getImage("setting_pressed"));
    // img = Image.createImage("/img/icon.png");
    // imgSave = Image.createImage("/img/icon.png");
    // imgEdit = Image.createImage("/img/icon.png");
    } catch (IOException ex) {
    ex.printStackTrace();
    }
    centerLabel = new Label("Center Label");
    centerLabel.setIcon(img);
    f.addComponent(BorderLayout.CENTER, centerLabel);
    f.addComponent(BorderLayout.NORTH, new Label("North Label"));

    f.addCommand(new Command("Exit",1));
    f.addCommand(new Command("Command2",2));
    f.addCommand(new Command("Command3",3));
    f.addCommand(new Command("Command4",4));
    f.addCommand(new Command("Command5",5));
    f.addCommand(new Command("Command6",r.getImage("help_normal"),6));
    f.addCommand(new Command("Command7",r.getImage("setting_normal"),7));
    f.addCommandListener(this);
    f.show();



    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void actionPerformed(ActionEvent arg0) {
    int cmdId = arg0.getCommand().getId();
    switch(cmdId){
    case 1 : exit(); break;
    case 2 : sampleAction(); break;
    }
    }

    private void sampleAction(){
    this.centerLabel.setText("Command2 Acknowledged!");
    }

    private void exit() {
    destroyApp(true);
    notifyDestroyed();
    }
    }
    heres the sample code i am using

  13. #13
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,738

    Re: Issue in loading images into command in lwuit for nokia s40

    Ah, this is something was thinking about, just did not ask because of the lack of my experience:
    - do you get all the commands even if they do not have icons next to them?
    - because if not, it probably means that you get an exception somewhere in the try block, and the later lines are not executed.
    I see those lines are commented now, but I assume we are actually talking about them.

  14. #14
    Registered User
    Join Date
    Nov 2012
    Posts
    47

    Re: Issue in loading images into command in lwuit for nokia s40

    hi wizard_hu_,

    every command is executed because i see the command name of every command on my ui and its actions also works fine the only thing is i cant see the icon of that command .

    Regards rahul

Similar Threads

  1. LWUIT IO (v1.5) ConnectionRequest's readResponse() Issue - Nokia SDK 2.0
    By Interactive-lem1313 in forum Mobile Java Tools & SDKs
    Replies: 4
    Last Post: 2012-07-16, 04:33
  2. Memory overflow error while loading .jpg images on nokia 6300
    By JBoson in forum General Development Questions
    Replies: 1
    Last Post: 2009-11-23, 08:16
  3. MovieClipLoader loadClip: issue while loading images
    By jappit in forum [Archived] Flash Lite on Nokia Devices
    Replies: 2
    Last Post: 2008-04-21, 10:12
  4. Loading 2 Images Loading Problem
    By nimbus_cloud in forum Symbian Media (Closed)
    Replies: 1
    Last Post: 2005-08-26, 05:51
  5. Error Loading Images Nokia 7210!!!
    By mrai in forum Mobile Java General
    Replies: 2
    Last Post: 2003-04-24, 17:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×