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
New Developer
Posts: 5
Registered: ‎09-16-2008
My Device: Not Specified

how to set string on sms edit

[ Edited ]

Hello,

 

 i can use _msg.setContent to change text in email edit,but i can not use _textmsg.setPayloadText change text in sms edit.

 

 how to change text in sms edit?

 

  It's code snippet

.......

ApplicationMenuItemRepository amir = ApplicationMenuItemRepository.getInstance();
amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_SMS_EDIT, asm);
amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_EMAIL_EDIT, asm);

.......



public Object run(Object context) {



if(context != null)
{
if(context.getClass().getName().equals("net.rim.blackberry.api.mail.Message"))
{
net.rim.blackberry.api.mail.Message _msg = (net.rim.blackberry.api.mail.Message)context;
if( _msg.getContent() instanceof TextBodyPart)
{
try{
_msg.setContent("Test New String");
}
catch(net.rim.blackberry.api.mail.MessagingException me){

}

}
_msg.updateUi();
}
else if(context.getClass().getName().equals("net.rim.device.cldc.io.sms.TextMessageImpl"))
{
javax.wireless.messaging.TextMessage _textmsg= (javax.wireless.messaging.TextMessage)context;
_textmsg.setPayloadText("Test New String");
}
}

}

.......

 

 thanks.

 

 

Message Edited by naitniq on 09-16-2008 10:48 PM
Message Edited by naitniq on 09-16-2008 10:54 PM
Message Edited by naitniq on 09-16-2008 10:58 PM
BlackBerry Development Advisor
Posts: 15,803
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: how to set string on sms edit

Please note that TextMessageImpl is an internal API and should not be referenced.  You can cast the object as a TextMessage.  However, SMS messages passed into an ApplicationMenuItem are read only.  Changes made to it are not reflected in the message the user is editing and sending.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Developer
Posts: 17,017
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: how to set string on sms edit

maybe a workaround would be to create a new textmessage and copy the attributes of the old one
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
Posts: 13
Registered: ‎05-29-2009
My Device: Not Specified

Re: how to set string on sms edit

Hi,
I am trying to run below code to get the Phone number in Native SMS Edit Screen on Storm device.

public Object run(Object context)
{

if (context instanceof javax.wireless.messaging.TextMessage) {
javax.wireless.messaging.TextMessage txtMsg = (javax.wireless.messaging.TextMessage) context;
String phNumber = txtMsg.getAddress();
............
Above code returns phone number on pearl, curve but not on STORM,,

Can anybody help me resolve this issue?

Thanks in Advance,,
Raghav.
BlackBerry Development Advisor
Posts: 15,803
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: how to set string on sms edit

What BlackBerry handheld software version are you testing on?  You can find this under Options, About on the BlackBerry Smartphone.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
New Developer
Posts: 13
Registered: ‎05-29-2009
My Device: Not Specified

STORM MenuItems, value retrival

Hi Mark,

Thanks a lot for your reply.

 

I am using BlackBerry 9500, v 4.7.0.78 (Platform 4.0.0.98).

 

With this I have found another issue, Please let me know your view on this.

 

I have a menuitem added using MENUITEM_PHONE,  MENUITEM_PHONELOG_VIEW....

 

I am able to get the phone numbers, call logs on Curve and pearl devices

 

but in case of STORM, we have 3 tabs which are for call menu(the dialing pad), call logs and contact.

The context finds value in case of Call Menu and Call logs, and doesn't works for Contact(Context is NULL in this case ). (But if I open the details of a perticular contact then I can find the context)....

(If I open the Native Contacts App seperatly then I can get the values from a perticular Contact without getting into the details...)

 

 

Please let us know if any sollution for above issue.

 

Thanks a lot..