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
Highlighted
Developer
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified
Accepted Solution

Accessing PIM info works on OS 4.2 - 4.5 but fails on OS 4.6

I use this code to access memo information on 8800 4.2 and 8800 4.5 and it works but when i use it on Flat Pearl with 4.6 I get a "java.lang.IndexOutOfBoundsException" when called from custom menuitem i added in memo app.

 

 

//Run is called when the custom menuItem is invoked

BlackBerryMemo memo;

public Object run(Object context)
{ //context object should be a memo
if (context instanceof BlackBerryMemo)
{
try{
_myBuffer.append("Notes ID: " + memo.getString( BlackBerryMemo.UID, 0 ) + "\r\n" );}
catch (Exception e) {System.out.println(e);}
}
return context;
}

 

The strange thing is that if i use this code:

 

_myBuffer.append("Notes ID: " + memo.getString( BlackBerryMemo.UID, 0 ) + "\r\n" ); 

 

in a regular CLDC app "not using custom menu" the same code works on the Flat Pearl.

 

anyone experience similar?
Developer
Posts: 107
Registered: ‎08-08-2008
My Device: Not Specified

Re: Accessing PIM info works on OS 4.2 - 4.5 but fails on OS 4.6

ugh... adding this code works:

 

 

if ( memo.countValues( BlackBerryMemo.UID ) > 0 ) { _myBuffer.append("Notes ID: " + memo.getString( BlackBerryMemo.UID, 0 ) + "\r\n" ); }