×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    20

    Listener problems with different Emulators

    i'm new to java development. i did c++ for symbian series60 until now.

    i've installed eclipse 3.1.2, Java SDK 1.5, carbide.j.
    then i started to play a little bit. everything works fine.

    then i programmed my first Listener. it's simple i thought. i just want to run a function if the user change from one textfild to another.
    i did it with setItemStateListener.

    Now here is my problem. After hours of testing i figured out that my code works!!! but only on the emulators
    - prototype_4_s80_640x200_MIDP_emulator
    and
    - prototype_4.0_Nokia_7710.

    if i use a other emulator s40 (different resolutions), s60 etc. the emulator starts corectly but the listener do not work.

    i really don't know what's the problem here.

    please help

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Location
    Bangalore , India
    Posts
    4,429

    Re: Listener problems with different Emulators

    Here is a similar discussion http://discussion.forum.nokia.com/fo...mStateListener

    Please give a try on the real device. Also I suggest to post your code so that some one could check it.

    Regards
    Gopal

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    20

    Re: Listener problems with different Emulators

    here is my code. it just sets a listener. if the user switches textfield the function RechnerStarten should be called. but it works only on 2 emulators and on real devices. (look 2 posts above)


    /* This file was created by Carbide.j */

    package Package;

    /* This file was created by Carbide.j */

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;

    //import package.rechnen.*;




    public class meineErsteKlasse2 extends MIDlet implements CommandListener, ItemStateListener
    {
    Image img;
    DateField dateField1;
    StringItem stringItem1;
    TextField textField1;
    TextField textField2;
    int a = 1;
    int b = 1;


    private Form mMainForm;

    public meineErsteKlasse2() {

    mMainForm = new Form("HelloMIDlet");
    mMainForm.append(new StringItem(null, "Hallo zäme! Das isch ds erschte MIDlet"));

    mMainForm.addCommand(new Command("Exit", Command.EXIT, 0));
    mMainForm.setCommandListener(this);


    try {
    textField1 = new TextField("TextField", "", 50, TextField.NUMERIC);

    mMainForm.append(textField1);

    textField2 = new TextField("TextField", "", 50, TextField.NUMERIC);
    mMainForm.append(textField2);
    stringItem1 = new StringItem("StringItem", "N/A", StringItem.PLAIN);
    mMainForm.append(stringItem1);


    mMainForm.setItemStateListener(this);


    }catch ( Exception e ) {
    }

    RechnerStarten();

    }

    public void itemStateChanged( Item item)
    {
    if(item == textField1)
    {
    RechnerStarten();
    }

    }


    public void RechnerStarten()
    {

    Rechnen rechner = new Rechnen();;
    a++;
    b++;
    rechner.a = a;
    rechner.b = b;

    int c = rechner.addieren();

    stringItem1.setText(""+c);

    }

    protected void startApp( ) throws MIDletStateChangeException
    {
    Display.getDisplay(this).setCurrent(mMainForm);
    }

    protected void pauseApp( )
    {

    }

    protected void destroyApp( boolean p1 ) throws MIDletStateChangeException
    {

    }

    public void commandAction(Command c, Displayable s) {
    notifyDestroyed();
    }

Similar Threads

  1. Several problems with NMIT 4.1 MMS
    By jtalviva in forum General Messaging
    Replies: 0
    Last Post: 2006-03-10, 11:03
  2. Several problems with NMIT 4.1
    By jtalviva in forum Mobile Java Tools & SDKs
    Replies: 0
    Last Post: 2006-03-10, 10:59
  3. Problems with diff emulators
    By djoeantony in forum Mobile Java General
    Replies: 0
    Last Post: 2003-06-04, 12:31

Posting Permissions

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