BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 09-22-2008, 11:22 AM   #1
Mikaël Donini
Knows Where the Search Button Is
 
Join Date: Sep 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 32
Default JAVA : how to retrieve the user-selected time interval in the calendar view

Please Login to Remove!

Dear All,

I have implemented a new JAVA ApplicationMenuItem in the calendar menu.
In the run() method of this application, I need to retrieve the time interval possibly selected by the user in the calendar view.

Do you know how to do that?

Thanks in advance for your support,

Mikaël Donini, Arkadin France.

Last edited by Mikaël Donini; 09-23-2008 at 04:28 AM..
Offline  
Old 09-23-2008, 03:38 AM   #2
lanfong
New Member
 
Join Date: Jan 2008
Model: 7290
PIN: N/A
Carrier: School Project
Posts: 12
Default

There's static method from TimeZone class
TimeZone.getDefault()

from Calendar class
calendar.getTimeZone()

From your case, the you probably already had the calendar object. you could just call calendar.getTimeZone() to get the selected timezone I think
Offline  
Old 09-23-2008, 03:52 AM   #3
Mikaël Donini
Knows Where the Search Button Is
 
Join Date: Sep 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 32
Default

Thanks but in fact it is not this time zone. In fact, my question was not very clear. In fact, I need to retrieve in JAVA the user-selected time interval in the calendar view (if there is). When I say time interval, it is for instance 10.00-11.00 if this time is selected in the calendar view.

I hope I am clear now.

Thanks again,

Mikaël.
Offline  
Old 09-23-2008, 01:22 PM   #4
lanfong
New Member
 
Join Date: Jan 2008
Model: 7290
PIN: N/A
Carrier: School Project
Posts: 12
Default

Are you talking about DateField in net.rim.api??? If so,

There's a method called getDate() that returns long.
What you do is create a Date object and pass the long value into constructor.
Code:
Date date = new Date(DateField.getDate());
// gets calendar instance to retrieve time
Calendar cal = Calendar.getInstance();
// sets the date object
cal.setDate(date);

// then you can do
cal.get(Calendar.HOUR)
cal.get(Calendar.MINUTE)
quote from documentation
==============
the given time field (either YEAR, MONTH, DATE, DAY_OF_WEEK, HOUR_OF_DAY, HOUR, AM_PM, MINUTE, SECOND, or MILLISECOND
But yours is able to select a time range and I dont know what class can do that since I haven't really play with time yet. Hope the code provided helps!!


Regards,

Lanf
Offline  
Old 09-24-2008, 10:37 AM   #5
Mikaël Donini
Knows Where the Search Button Is
 
Join Date: Sep 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 32
Default

Thanks for your answer but same problem : I do not know how to retrieve the user selected date in the calendar in JAVA.

What is the user selected date in the blackberry calendar? it is the time range selected by the user. When the blackberry user selects a time range in the calendar and then run the "New" command to create a new appointment, then the start and end fields of the newly opened appointment are initialized with the time selected by the user.
Offline  
Old 09-24-2008, 02:23 PM   #6
lanfong
New Member
 
Join Date: Jan 2008
Model: 7290
PIN: N/A
Carrier: School Project
Posts: 12
Default

This is the class you should be working with "Event" class
javax.microedition.pim.Event

Code:
         if (events.isSupportedField(Event.START)) {
                 event.addDate(Event.START, 0, start);
         }
         if (events.isSupportedField(Event.END)) {
                 event.addDate(Event.END, 0, start + 72000000);
         }
should be something like that



One more thing, are you trying to capture what users select when they add a new calendar????
Offline  
Old 09-25-2008, 02:35 AM   #7
Mikaël Donini
Knows Where the Search Button Is
 
Join Date: Sep 2008
Model: 7100T
PIN: N/A
Carrier: none
Posts: 32
Default

Yes, I try to capture what users select when they add a new calendar. THIS is my question
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Schneider Electric Inverter ATV 320 5.5kW ATV320U55N4B New picture

Schneider Electric Inverter ATV 320 5.5kW ATV320U55N4B New

$798.00



Lenze AC Tech ESV152N02YXB559 Inverter picture

Lenze AC Tech ESV152N02YXB559 Inverter

$329.99



Lenze AC Tech ESV251N02SXB Inverter picture

Lenze AC Tech ESV251N02SXB Inverter

$249.99



New Schneider Inverter ATV930D11N4 Frequency Converter picture

New Schneider Inverter ATV930D11N4 Frequency Converter

$1050.00



VEVOR 7.5KW 10HP Variable Frequency Drive Inverter Convert 1 To 3 Phase VFD 220V picture

VEVOR 7.5KW 10HP Variable Frequency Drive Inverter Convert 1 To 3 Phase VFD 220V

$159.99



PLC55 Inverter Air Plasma Cutter 55Amp IGBT 110V/220V Cutting Machine picture

PLC55 Inverter Air Plasma Cutter 55Amp IGBT 110V/220V Cutting Machine

$138.99







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.