×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    6

    How to add Date(any date.. to show last updated time) to CustomItem

    Hi All,

    I want to add Date(any date.. to show last updated time) to CustomItem for my application. How can I add date or date field to the CustomItem. Is it possible in j2me(MIPD2.0) or not?

    Awaiting for reply,

    - Durga.

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to add Date(any date.. to show last updated time) to CustomItem

    Hi Durga,

    and welcome to Forum Nokia Discussion Boards

    About your question: when using CustomItems, you can actually paint whatever you want inside them, just implementing the paint() method. So, in your case, you could come up with something like this:
    Code:
    protected void paint(Graphics g, int w, int h)
    {
    	g.setColor(0x000000);
    			
    	Date d = new Date();
    			
    	Calendar c = Calendar.getInstance();
    			
    	c.setTime(d);
    			
    	String dateString = c.get(Calendar.DAY_OF_MONTH) + "/" + 
    		c.get(Calendar.MONTH) + "/" + 
    		c.get(Calendar.YEAR);
    			
    	g.drawString(dateString, 0, 0, Graphics.TOP | Graphics.LEFT);
    }
    Pit

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    6

    Re: How to add Date(any date.. to show last updated time) to CustomItem

    Thanks alot Pit..it's working.. and I implemented the same in my application. And one more question I have, it's regarding showing a link(hyperlink like.. more or next) in CustomItem and it should be selectable. Please help me in this regard bcoz it's urgent.
    Thanks again,
    - Durga.

  4. #4
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to add Date(any date.. to show last updated time) to CustomItem

    Hi Durga,

    as for the previous CustomItem, to build a hyperlink item you should implement all the painting/user interaction functionalities you need. In the case of an hyperlink, what you need to do should be:

    * draw the hyperlink, implementing the paint() method as done above for the custom date field
    * handle the user "clicks" on the hyperlink itself: you can do this by implementing the keyPressed() method
    * if the hyperlink should open the phone browser, then you must use the MIDlet platformRequest method

    You can give it a try, and check if it works..

    Pit

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    6

    Re: How to add Date(any date.. to show last updated time) to CustomItem

    Hi Pit,

    You are saying something like creating a new Custom Item right???
    No, Actually I want to add Title, Date, some Image, some description(any text) and finally a link(hyperlink) to a Single CustomItem only. I have tried with all the other items except hyperlink. I couldn't make it work for hyperlink.
    Plese give me a suggestion in this regard.

    Thanks again for your good ideas/suggestions. It's really helping me to develop my application.

    Best Regards,
    Durga.

  6. #6
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,406

    Re: How to add Date(any date.. to show last updated time) to CustomItem

    Hi Durga,

    since you have to implement all CustomItem functionalities, you can put any content you want inside it. So, in the paint() method defined above, you can paint, after the date, also a String representing the hyperlink.

    Note that, if you want to enable also internal navigation in the CustomItem itself, you should also take care (and implement) the traverse() and traverseOut(), that will allow you to switch from a "subitem" to another, or to do other operations on the CustomItem itself.

    Pit

  7. #7
    Registered User
    Join Date
    Aug 2008
    Posts
    6

    Re: How to show multiple custom items in a form ?

    Hi,

    I am trying to add a customitem repeatedly (more than 10 times)to a form with preferred content height set to 50. But I am not able to see all the added customitems when I scroll down. I could see only 3/4 customitems.

    If I set the preferred content height to some high value (ex: 180) I am able to scroll and see all the customitems.

    Can someone please explain why this difference in behaviour and how I can view all the customitems with a lower value of preferred content height?

    Thanks in advance.

Similar Threads

  1. any way to avoid entering time and date? help
    By rohit330 in forum General Development Questions
    Replies: 0
    Last Post: 2008-03-21, 11:31
  2. Unwanted date and time reset
    By papana in forum Symbian
    Replies: 0
    Last Post: 2008-03-03, 17:33
  3. Date & Time Editor in Form Resource.
    By Kavit Patel in forum Symbian
    Replies: 2
    Last Post: 2008-03-03, 06:26
  4. Replies: 0
    Last Post: 2008-01-03, 17:58
  5. date and time
    By melas21 in forum Mobile Java General
    Replies: 3
    Last Post: 2003-10-06, 13:21

Posting Permissions

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