Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Mikael
Posts: 21
Registered: ‎10-09-2008
My Device: Not Specified

run method - ApplicationMenuItem class - current screen values

In JAVA, I have implemented a new menu item to the "New Appointment" window (of the calendar view).

In the run() method of my ApplicationMenuItem class, I need to retrieve the data that have been written by the user in the summary field.

The problem is the following. Let's suppose the following scenario:

1- The blackberry user enters a value in the summary field of the new appointment.

2- Then he clicks on my new menu item --> now run() method of my ApplicationMenuItem class is executed. At the beginning of the run() method, I need to know the value enters by the user in the summary field.
But as the user has not saved his appointment before invoking my command, I can't access the value of the summary field. I have tested to execute the following code, but it does not work:

 

 

public Object run(Object context) { try { UiApplication.getUiApplication().getActiveScreen().save(); } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } // Here, I would like to retrieve the value of the summary field, but don't know how BlackBerryEvent e = (BlackBerryEvent) context; String sum = e.getString(Event.SUMMARY, 0); // it is empty; why??

 Then, I have tried the following code, but it does not work.

 

 

public Object run(Object context) { BlackBerryEvent e = (BlackBerryEvent) context; try { e.commit(); } catch (PIMException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } String sum = e.getString(Event.SUMMARY, 0); // it is empty, why ????

 

 Do you have any idea?

Thanks in advance,

Mikaël.

 

 

 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: run method - ApplicationMenuItem class - current screen values

The user would need to save the changes before they are seen in the object passed into your application.  This is by design.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker