LWUIT DateField and other bits

We missed having a DateField in LWUIT, the Calendar is a great start but it looked a little strange on some phones and we needed something simpler, not to mention a time field.

To do this we extended the TextArea class to create our own MobrizDateField.  When the user clicks on this the system fires up a standard LCDUI form with a DateField on it (DateForm).  The user can then use the native time/date features of the phone to complete the date/time

To tell LWUIT to intercept the DateField calls  we extended the GameCanvasImplementation to create our own MobrizMidpImplementation.  This overrides the editString method and launches the DateForm if the MobrizDateField is being used. We needed a MobrizImplementationFactory to deliver this too.

To tell LWUIT to use the new MobrizMidpImplementation add the following to your code where you initailise the UI.


..
ImplementationFactory.setInstance(new MobrizImplementationFactory());
Display.init(this.mobrizMidlet);
..

Use the new MobrizDateField just like a TextArea:


..
MobrizDateField timeField = new MobrizDateField(dtLong + "", 10,MobrizDateField.TIME, "");
form.addComponent(timeField) ;
..

Things to note:

  • The MobrizDateField takes a string or a long expressed as a string in the constructor .. this is a bit crap but suited us for our app. you may want to change it match to LCDUI datefield exactly.
  • The MobrizDateField actually extends MobrizTextArea which is a TextArea that responds to any key press.

Would welcome any comments or improvments!!!

As ever this code is provided without warranty – user at you own risk.

Here is the source

449 Responses to “LWUIT DateField and other bits”

  1. Marcos Maia says:

    Hi,

    first of all, tx for the excellent work. I’m evaluating your solution, already using in a prototype and it’s working fine so far.

    All I had to do was instantiate your factory:
    ImplementationFactory.setInstance(new MobrizImplementationFactory());
    Display.init(this);

    and than:

    MobrizDateField timeField = new MobrizDateField(new Date().getTime() + “”, 10,MobrizDateField.DATE, “dmy”);
    myLWUITPanel.addComponent(timeField) ;

    tx, I’ll let you know when better tested.
    regards,
    []s

    Marcos Maia.

  2. rspence says:

    Thanks Marcos

    Glad it was of use. There are a few holes which were cool for our requirements but probably need fixing for a generic solution.

    Let me know if you make any improvements

    Regards

    Richard

  3. Hi! I like your srticle and I would like very much to read some more information on this issue. Will you post some more?

  4. rspence says:

    Thanks very much … not sure I have much more to add on this topic apart from get the LWUIT source code down and see how this fits in. Another guy has done a LCDUI port and someone else has had a real stab at Blackberry.

    Cheers

    Richard

  5. rspence says:

    This is another attempt at a full LCUDI port lcduilwuit.googlecode.com

  6. CARLOS says:


    CheapTabletsOnline.Com. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. Low price drugs. Buy drugs online

    Buy:Prevacid.Nexium.Actos.Prednisolone.Arimidex.Zyban.100% Pure Okinawan Coral Calcium.Lumigan.Accutane.Mega Hoodia.Zovirax.Synthroid.Valtrex.Retin-A.Petcam (Metacam) Oral Suspension.Human Growth Hormone….

  7. CASEY says:


    NEW FASHION store. Original designers collection at low prices!!! 20 % TO 70 % OFF. END OF SEASON SALE!!!

    BUY FASHION. TOP BRANDS: GUCCI, DOLCE&GABBANA, BURBERRY, DIESEL, ICEBERG, ROBERTO CAVALLI, EMPORIO ARMANI, VERSACE…

  8. EVAN says:

    ████████►BUY VIAGRA◀███████…

    ████████▲▲▲▲▲▲▲▲▲████████…

  9. LONNIE says:

    abilify side effects in children

    Buydrugs without prescription…

  10. EUGENE says:

    Advair@official.site” rel=”nofollow”>.

    Buynow it…

  11. KELLY says:

    Ampicillin@official.site” rel=”nofollow”>.

    Buynow it…

  12. LARRY says:

    ..

    Buygeneric drugs…

  13. ALBERTO says:

    Augmentin@official.site” rel=”nofollow”>.

    Buywithout prescription…

  14. RICK says:

    Clonidine@official.site” rel=”nofollow”>…

    Buynow…

  15. RICK says:

    celexa@canada.now” rel=”nofollow”>.

    Buynow…

  16. DOUGLAS says:

    Abilify@official.site” rel=”nofollow”>…

    Buynow…

  17. CLINTON says:

    Zocor

    Buygeneric meds…

  18. STUART says:

    zestoretic co-q10

    Buywithout prescription…

  19. REGINALD says:

    dog zyrtec

    Buygeneric drugs…

  20. ALFONSO says:

    Zyvox

    Buydrugs without prescription…

  21. ISAAC says:

    lioresal online

    Buygeneric drugs…

  22. CHAD says:

    Zyprexa

    Buydrugs without prescription…

  23. CHRIS says:

    Rogaine

    Buygeneric meds…

  24. AARON says:

    Risperdal

    Buygeneric pills…

  25. CLAUDE says:

    Tri@Cyclen.now” rel=”nofollow”>…

    Buyno prescription…

  26. GEORGE says:

    Soma@Soma.Soma” rel=”nofollow”>.

    Buyno prescription…

  27. SAM says:

    Purim@Purim.Purim” rel=”nofollow”>…

    Buygeneric drugs…

  28. EDGAR says:

    Singulair@Singulair.Singulair” rel=”nofollow”>…

    Buygeneric pills…

  29. TYRONE says:

    Prozac@Prozac.Prozac” rel=”nofollow”>.

    Buygeneric pills…

  30. SEAN says:

    Singulair@Singulair.Singulair” rel=”nofollow”>.

    Buygeneric drugs…

  31. REX says:

    Prozac@Prozac.Prozac” rel=”nofollow”>..

    Buyit now…

  32. MANUEL says:

    allegra@print.colorado.springs” rel=”nofollow”>…

    Buygeneric drugs…

  33. KIRK says:

    alternatives@to.premarin” rel=”nofollow”>…

    Buygeneric pills…

  34. ADRIAN says:

    altace@generic.name” rel=”nofollow”>.

    Buynow it…

  35. Alexander7 says:

    buy@generic.LEVITRA” rel=”nofollow”>…

    Need cheap generic LEVITRA?…

  36. WESLEY says:

    ..

    Buywithout prescription…

  37. OSCAR says:

    Order@Cheap.Coral.Calcium” rel=”nofollow”>…

    Buygeneric drugs…

  38. JOSE says:

    Order@Discount.Coral.Calcium” rel=”nofollow”>..

    Buydrugs without prescription…

  39. GERARD says:

    Purchase@Discount.Coral.Calcium” rel=”nofollow”>..

    Buynow…

  40. JEREMY says:

    Cheap@Coral.Calcium.Online” rel=”nofollow”>..

    Buygeneric drugs…

  41. SERGIO says:

    Buy@Abana.Online” rel=”nofollow”>.

    Buywithout prescription…

  42. EARL says:

    Buy@Discount.Abana” rel=”nofollow”>..

    Buygeneric meds…

  43. JEROME says:

    Order@Cheap.Abana” rel=”nofollow”>…

    Buynow…

  44. RALPH says:

    Buy@Abilify.Online” rel=”nofollow”>.

    Buywithout prescription…

  45. RONNIE says:

    Buy@Cheap.Abilify” rel=”nofollow”>..

    Buynow it…

  46. BARRY says:

    Order@Cheap.Abilify” rel=”nofollow”>.

    Buynow it…

  47. ALBERTO says:

    Purchase@Cheap.Abilify” rel=”nofollow”>.

    Buydrugs without prescription…

Leave a Reply

You must be logged in to post a comment.