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
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

regarding integrating the app

plz look at pic , i hve integrated the default sms amd email app of the phone with navigation click of two bitmap

when i click to the email(see last icon) the default app is opened working fine and app does not goes to background but when i click to open the sms app of phone the my app will goes to background   here is my code

 

public class CustomSpinnerPopup extends PopupScreen
    {
    	HorizontalFieldManager sharescreen;
    	
    	public CustomSpinnerPopup(){
    		super(new VerticalFieldManager(), Screen.DEFAULT_CLOSE);  
    		//this.setBackground(BackgroundFactory.createSolidBackground(Color.AZURE));
    		
    		this.setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITESMOKE, 150));
            setBorder(BorderFactory.createSimpleBorder(new XYEdges(),Border.STYLE_TRANSPARENT));
    		sharescreen = new HorizontalFieldManager();
    		BitmapField fieldDemo1 = new BitmapField(buttonRight1,FOCUSABLE); 
    		BitmapField fieldDemo2 = new BitmapField(buttonRight2,FOCUSABLE); 
    		
    		// open default sms app
    		BitmapField fieldDemo3 = new BitmapField(buttonRight3,FOCUSABLE){
				protected boolean navigationClick(int status, int time) {
					// TODO Auto-generated method stub
					try {
						MessageConnection mc = (MessageConnection)Connector.open("sms://");
						TextMessage m = (TextMessage)mc.newMessage( MessageConnection.TEXT_MESSAGE );
						m.setAddress("sms://5558888");
						m.setPayloadText("An SMS message for you");
						
						Invoke.invokeApplication( Invoke.APP_TYPE_MESSAGES, new MessageArguments(m) );
						
					} catch (Exception e) {
						// TODO Auto-generated catch block
						System.out.println("ssssssss"+e.toString());
					}
					return true;
				}
    		}; 
    		
    		//open default email application of phone
    		BitmapField fieldDemo4 = new BitmapField(buttonRight4,FOCUSABLE){

				protected boolean navigationClick(int arg0, int arg1) {
					// TODO Auto-generated method stub
					try {
						String s = null;
						 Message m = new Message();
						    Address a = null;
						    try
						    {
						        a = new Address("","");
						    }catch(AddressException e) {
						        // TODO Auto-generated catch block
						        e.printStackTrace();
						    }
						    Address[] addresses = {a};
						    try
						    {
						        m.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses);
						        m.setContent(s);
						    } catch (MessagingException e) {
						        // TODO Auto-generated catch block
						        e.printStackTrace();
						    }
						    m.setSubject("");
						    Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
					} catch (Exception e) {
						// TODO Auto-generated catch block
						System.out.println("www"+e.toString());
						e.printStackTrace();
					}
					
					return true;
				}
    			
    		}; 
    		
    		fieldDemo1.setPadding(5, 10, 5, 10);
    		fieldDemo2.setPadding(5, 10, 5, 10);
    		fieldDemo3.setPadding(5, 10, 5, 10);
    		fieldDemo4.setPadding(5, 10, 5, 10);
    		
    		sharescreen.add(fieldDemo1);
    		sharescreen.add(fieldDemo2);
    		sharescreen.add(fieldDemo3);
    		sharescreen.add(fieldDemo4);
    		
    		this.add(sharescreen);
    		
    		
    	}
    	
    	
    }

 

Please use plain text.
Developer
peter_strange
Posts: 19,595
Registered: ‎07-14-2008
My Device: Not Specified

Re: regarding integrating the app

"plz look at pic"  What pic?

 

And your problem is?

 

Can you just include the code that is giving you the problem rather than cut and pasting all you code.  For example, in this case we don't care whether the code is initiated by a Button or a menu, you are telling is sone code is not working as you would like it to. So we only need that code.

 

And we woud like as much informaiotn as you can give us.

http://supportforums.blackberry.com/t5/Java-Development/Information-to-include-when-posting-to-the-J...

http://www.catb.org/esr/faqs/smart-questions.html#beprecise

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: regarding integrating the app

[ Edited ]

that pic ,when i click to open the default sms app, my app goes to background, while debugging i found in console

 

Starting net_rim_bb_messaging_app
[0.0] net_rim_bb_messaging_app already running
[0.0] VM:LNTDa=commit,t=0,p=net_rim_bb_messaging_app
[0.0] Starting net_rim_bb_messaging_app
[0.0] net_rim_bb_messaging_app already running
[0.0] Foreground net_rim_bb_messaging_app(54)
[0.0] Detected background switch for Mytest(186) who has NO tunnels open - defocus NOT called
[0.0] Detected foreground switch for net_rim_bb_messaging_app(54) who has NO tunnels open - focus NOT call[0.0] ed
[0.0] FocusHistory: Focus lost; App Mytest; Component NULL
[0.0] FocusHistory: Focus lost; App Mytest; Component mypackage.HighResolutionScreen$3
[0.0] FocusHistory: Focus gained; App net_rim_bb_messaging_app; Component net.rim.device.apps.api.messagin[0.0] g.messagelist.MessageListUI$MessageListVariableHeightListField
[0.0] FocusHistory: Focus lost; App net_rim_bb_messaging_app; Component net.rim.device.apps.api.messaging.[0.0] messagelist.MessageListUI$MessageListVariableHeightListField
[0.0] FocusHistory: Focus gained; App net_rim_bb_messaging_app; Component net.rim.device.apps.internal.sms[0.0] compose.conversation.SMSUiReplyField
[0.0] FocusHistory: Focus lost; App net_rim_bb_messaging_app; Component net.rim.device.apps.internal.smsco[0.0] mpose.conversation.SMSUiReplyField
[0.0] VM:smileytongue:ISVt=0,h=1aec,id=d15a33128dfbb5d9

 

 

 

9630.png

Please use plain text.
Developer
simon_hain
Posts: 15,806
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: regarding integrating the app

isn't it normal for an application to go into the background when another one goes to the foreground?
----------------------------------------------------------
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
Please use plain text.