×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor
    Join Date
    Mar 2010
    Location
    Bangalore
    Posts
    50

    Question Any Restrictions ?

    Hi,

    I am developing a code in j2me and i find certain actions not taking place.
    Is there any restriction OR limitation to have only a certain amount of "Form" , "List" classes to be used inside a single program ?

    This is because even though I've given the necessary statements , i find no redirection taking place. I've used many form and list classes in my code.

    PS : I've initialized certain statements in the beginning itself.

    private void Abcd( );
    {
    display = Display.getDisplay(this);
    abcde = new Form ("Hello");
    abcde.append("Hi");
    next = new Command("Go" , Command.SCREEN , 1 );
    abcde.addCommand(next);
    abcde.setCommandListener(this);
    display.setCurrent(abcde);
    }

    When i call this function , it does not get executed. I've initialized all the necessary elements.
    I say something like

    if ( command == find )
    {
    Abcd( );
    }

    This action does not take place.

    Kindly help.


    Thanks
    - Ashwin
    Last edited by itzashwin; 2010-05-18 at 06:12. Reason: Added a few points

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Any Restrictions ?

    Shouldn't be any restrictions. My suggestion: debug your application step-by-step, until you find what you are doing wrong in the code.

    Hartti

  3. #3
    Regular Contributor
    Join Date
    Mar 2010
    Location
    Bangalore
    Posts
    50

    Re: Any Restrictions ?

    Hi,

    I'll do that.

    But,is it irrespective of the classes am using ?

    Because , i use the ChoiceGroup , StringItem , TextField , Form and List class in the same code.

    I also use String[].

    Thanks
    - Ashwin

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Any Restrictions ?

    When i call this function , it does not get executed. I've initialized all the necessary elements.
    I say something like

    if ( command == find )
    {
    Abcd( );
    }
    Hi the method call can not be successfull due to various reasons.Like this

    1.The display object is null.
    2.Command "find" is null...etc
    I would recommend that always put the code in try-catch block. Also I would recommend you that you put the system.out.paintln statements and try to debug the code that in which line the exactly exception is there..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Regular Contributor
    Join Date
    Mar 2010
    Location
    Bangalore
    Posts
    50

    Re: Any Restrictions ?

    Hi Raj,

    A few thoughts:

    1. What did you mean by "Display object is null" ?

    2. I've initialised "find" in another part of the program , its just that it does not respond when i click on "find".

    3. Can i call the same function in two places ?

    like this:

    if ( command == find )
    {
    Abcd( );
    }

    else if
    .
    .
    .
    .

    else if (command == go)
    {
    Abcd( ) ;
    }

    else
    .
    .
    .


    I've also tried ---> System.out.println("Hi");

    - Unsuccessful

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Any Restrictions ?

    When you are putting the System.out.println()'s then upto which line the control is coming?

    Put System.out.println() after every line in that method.Yeah you can call the method any time as you wanna.
    The portion where you have initialize everything, did you call that code base before this method?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Regular Contributor
    Join Date
    Mar 2010
    Location
    Bangalore
    Posts
    50

    Re: Any Restrictions ?

    When i use something like this:

    if (command == find)
    {
    System.out.println("hi");
    }

    OR

    if (command == find)
    {
    Abcd();
    }

    - "find" command does not respond at all. I use a "back" command in the same page , it responds and does the desired action. There is a problem only in this place when i give the command option.
    Last edited by itzashwin; 2010-05-18 at 07:53.

  8. #8
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Any Restrictions ?

    Are you sure that command is ever created?

    I guess that command is somehow null.
    Did you put the initialization code inside the try-catch?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  9. #9
    Regular Contributor
    Join Date
    Mar 2010
    Location
    Bangalore
    Posts
    50

    Re: Any Restrictions ?

    I've initialized all the necessary elements earlier or I have initialized them where it is needed , the compiler shows no error in my code.

    I also tried the try and catch method , no improvement.

    Thanks
    - Ashwin

  10. #10
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Any Restrictions ?

    Share the code here, if this is not too big, or try to debug the code, surely there is some issue with the command creation,
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Any Restrictions ?

    Also check that you had added that command to the Form?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  12. #12
    Regular Contributor
    Join Date
    Mar 2010
    Location
    Bangalore
    Posts
    50

    Re: Any Restrictions ?

    Hi Raj,

    Finally its done. I never knew that there are priority issues in these. I just shuffled this if statement and placed it on top of another if , it works fine. Should have tried it much earlier rather than seeing the whole code again for any errors or missed declarations. Anyways , a learning experience ! . Thanks a lot for your inputs.


    - Ashwin
    Last edited by itzashwin; 2010-05-19 at 05:24.

  13. #13
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: Any Restrictions ?

    Quote Originally Posted by itzashwin View Post
    Hi Raj,

    Finally its done. I never knew that there are priority issues in these. I just shuffled this if statement and placed it on top of another if , it works fine. Should have tried it much earlier rather than seeing the whole code again for any errors or missed declarations. Anyways , a learning experience ! . Thanks a lot for your inputs.


    - Ashwin
    That's really interesting to know but the normal behaviour of the commands. As the Java ME docs says something like this,
    The application uses the priority value to describe the importance of this command relative to other commands on the same screen. Priority values are integers, where a lower number indicates greater importance. The actual values are chosen by the application. A priority value of one might indicate the most important command, priority values of two, three, four, and so on indicate commands of lesser importance.

    Typically, the implementation first chooses the placement of a command based on the type of command and then places similar commands based on a priority order. This could mean that the command with the highest priority is placed so that user can trigger it directly and that commands with lower priority are placed on a menu. It is not an error for there to be commands on the same screen with the same priorities and types. If this occurs, the implementation will choose the order in which they are presented.
    Anyways great job done by you..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Replies: 2
    Last Post: 2009-05-12, 18:27
  2. Restrictions to access SIM ToolKit (S40)
    By heuven in forum Mobile Java Networking & Messaging & Security
    Replies: 4
    Last Post: 2009-02-04, 16:32
  3. OTA Size Restrictions
    By criswick in forum Mobile Java General
    Replies: 1
    Last Post: 2002-10-30, 17:09
  4. Time based Call restrictions
    By wsmolich in forum Digital Rights Management & Content Downloading
    Replies: 0
    Last Post: 2002-09-16, 12:00
  5. Restrictions on the size of UTF-8 encoding for chinese?
    By goeast in forum Mobile Java General
    Replies: 0
    Last Post: 2002-09-08, 04:08

Posting Permissions

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