java-memidplcduicldcnokia-s40

J2me ticker not displayed correctly. Help me to try to solve it


I'm developing a mobile application with j2me. The configuration is "CLDC 1.1" & "MIDP 2.0". The phone I used for testing purpose is "NOKIA C2-01". The phone is "S40" device.

In that mobile app the data is send to server and perform based on response. I added the ticker to the Displayable (the Displayable may be form, list, etc).

When application runs the ticker is shown sometimes correctly, but sometimes the ticker is not correctly displayed: the space for ticker is appeared above the form/list, but ticker is not displayed.

Please help me to solve it.

I am just assigning the form and list to the object of (Displayable) displayable.

Then I create a new Ticker object and I set the ticker by displayable.setTicker(Ticker ticker) method. Sometimes ticker is shown correctly sometimes ticker not shown.

the following are my conding snippets-some sample only

public class Controller
{
  Form loginForm;
  List userLit;
  Ticker tikcer;
  Display display;
  Displayable displayable;

  public Controller()
  {
    display=Display.getDisplay(midlet);
    displayable=null;

    loginForm=new LoginForm("Login");
    userList=List("user list", Choice.IMPLICIT);
  }

  public void showLoginForm()
  {
    displayable=loginForm;
    display.setCurrent(loginForm);
  }

  public void showUserList()
  {
    displayable=userList;
    display.setCurrent(userList);
  }

  public void setTickerToDisplayable(String str)
  {
    ticker=null;
    if((str==null)||(str.length()<1))
      ticker=null;   
    else
      ticker=new Ticker(str);
    displayable.setTicker(ticker);
  }
}

Solution


  • I find the solution.Sometimes if application gets more memory means then ticker not displayed correctly.


    Now i modified my code with respect to decrease the memory leaks.Now its working