Discussion Board

Results 1 to 6 of 6

Thread: previous screen

  1. #1
    Registered User reshmy's Avatar
    Join Date
    Mar 2008
    Posts
    29
    hi..
    how to display d previous screen in d midlet?just previous screen ?with out using d this command like
    display.setCurrent(name of last screen());

  2. #2
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    There's not a standard way to do this. You could try mantaining an history of visited screen within a Vector, and when goind back you'll take the last inserted element (removing it from the Vector) and display as current screen.

    Pit

  3. #3
    Registered User reshmy's Avatar
    Join Date
    Mar 2008
    Posts
    29
    hi...
    how to create such a vector of history of visited screen?

  4. #4
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    Here's a simple class that can manage next/previous screens. You should use it to change screens within your j2me app.

    import java.util.Vector;

    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.midlet.MIDlet;

    public class ScreenManager
    {
    MIDlet midlet = null;
    Vector history = null;
    Displayable currentScreen = null;

    public ScreenManager(MIDlet midlet)
    {
    this.history = new Vector();
    this.midlet = midlet;
    }
    public void gotoScreen(Displayable nextScreen)
    {
    if(currentScreen != null)
    {
    history.addElement(currentScreen);
    }
    currentScreen = nextScreen;

    Display.getDisplay(midlet).setCurrent(nextScreen);
    }
    public void gotoPreviousScreen()
    {
    if(history.size() > 0)
    {
    currentScreen = (Displayable)history.lastElement();

    history.removeElement(currentScreen);

    Display.getDisplay(midlet).setCurrent(currentScreen);
    }
    }
    }
    Pit

  5. #5
    Registered User reshmy's Avatar
    Join Date
    Mar 2008
    Posts
    29
    hi..
    how to use this code in midlet?

  6. #6
    Nokia Developer Champion jappit's Avatar
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,391
    You should instantiate an object of this class, and then use it everytime you need to go to another screen (so, you should not call directly Display.getDisplay(midlet).setCurrent() method).

    So, let's say u'r on screen A and want to go to screen B, you'll call:

    managerInstance.gotoScreen(bScreenInstance);

    Then, if you want to go back to previous screen, you'll call:

    managerInstance.gotoPreviousScreen();

    Anyway, this is only a basic example of how screen management can be implemented. You can freely implement yours once you've understood the base concept.

    Pit

Similar Threads

  1. Custom window in ALL screen modes
    By PawelDefee in forum Symbian C++
    Replies: 11
    Last Post: 2009-02-11, 09:19
  2. Problem with E90 and secondary screen
    By Tatanka.nbr1 in forum Symbian C++
    Replies: 5
    Last Post: 2008-06-27, 10:01
  3. Direct Screen Access (Please Comment!)
    By earamsey in forum Symbian C++
    Replies: 1
    Last Post: 2006-07-28, 18:34
  4. UI: Full Screen Mode
    By GENERAL_INFO in forum Symbian User Interface
    Replies: 3
    Last Post: 2004-11-22, 06:27
  5. Previous screen rendered on command list display [7250]
    By cozmo911 in forum Mobile Java General
    Replies: 0
    Last Post: 2004-04-28, 01:01

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved