• Using StringItem as a placeholder in J2ME: OutOfMemory error on k750

    by  • March 21, 2008 • j2me • 0 Comments

    I’ve been using the following:

    stringItem = new StringItem(null,null, Item.PLAIN);

    to indicate a placeholder for a string in a form on a J2ME application, debugged using the Wireless Toolkit emulator provided with NetBeans. This is perfectly valid w.r.t the stringitem API. 

     All was fine until deploying it onto an  actual device, namely a SE k750, where I was getting spurious OutOfMemory exceptions. Debugging and stepping through the code, it seemed when you tried to apply a label or text to the placeholder stringItem using setText() or setLabel(), you got an OutOfMemory exception. So instead I used:

    stringItem = new StringItem(null,””, Item.PLAIN);

    and the problem seems to have disappeared. Not sure why this is the case, but I thought I’d post it for future reference!


    .NET developer at thetrainline.com, previously web developer at MRM Meteorite. Awarded a PhD in misbehaviour detection in wireless ad-hoc networks. A keen C# ASP.net developer bridging the gap with APIs and JavaScript frameworks, one web app at a time.


    Leave a Reply

    Your email address will not be published. Required fields are marked *