BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-04-2008, 07:42 AM   #1
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default email

Please Login to Remove!

Hi everyone.

I just want to invoke the email API with a destinary.

But when I do this :

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES ,new MessageArguments(MessageArguments.ARG_NEW, desti, "Email", "Body"));

It launch a new screen with SMS on the top.

So I want an email and not a sms.

How can I process???
Offline  
Old 07-04-2008, 08:16 AM   #2
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

from developer guide (not tested but seems OK):

Code:
net.rim.blackberry.api.mail.Message m = new net.rim.blackberry.api.mail.Message();
Address a = new Address("mLi@rim.com", "Ming Li");
Address[] addresses = {a};
m.addRecipients(net.rim.blackberry.api.mail.Message.RecipientType.TO, addresses);
m.setContent("A message for you...");
m.setSubject("Email for you");

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
Offline  
Old 07-04-2008, 08:19 AM   #3
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

I will test it and tell you if it's works
Offline  
Old 07-04-2008, 08:28 AM   #4
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

Nothing happens.
Offline  
Old 07-04-2008, 08:37 AM   #5
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

works for me on 8800 simulator (4.2.1)

Code:
		Message m = new Message();
		Address a;
		try {
			a = new Address("mLi@rim.com", "Ming Li");
			Address[] addresses = {a};
			m.addRecipients(Message.RecipientType.TO, addresses);
			m.setContent("A message for you...");
			m.setSubject("Email for you");

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
Offline  
Old 07-04-2008, 08:46 AM   #6
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

But this send directly an email or jsut launch the email module???
Offline  
Old 07-04-2008, 08:47 AM   #7
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

It shows a new prefilled E-Mail
Offline  
Old 07-04-2008, 08:53 AM   #8
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

Allright.

I will work on it.
Offline  
Old 07-04-2008, 09:16 AM   #9
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

When I try to launch what you give me,I have this :

Uncaught exception thrown - ClassCastException.

Any idea???
Offline  
Old 07-04-2008, 09:19 AM   #10
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

I guess you are using jde 4.1.0. In that SDK there is no way to pass a Message to the MessageArguments constructor...
Offline  
Old 07-04-2008, 09:28 AM   #11
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

No I use the jde 4.3
Offline  
Old 07-04-2008, 09:38 AM   #12
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

then it should work. Are you using the right Message class? from net.rim.blackberry.api.mail.Message
Offline  
Old 07-04-2008, 09:45 AM   #13
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

Yes I'm sure thaht is the right Message.

I will write some Sytem.out.prinln to find where the problem is
Offline  
Old 07-04-2008, 09:49 AM   #14
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

System.out.println("test mail 1");
net.rim.blackberry.api.mail.Message m = new Message();
System.out.println("test mail 2");
Address abc;
System.out.println("test mail 3");
try
{
abc = new Address("mLi@rim.com", "Ming Li");
System.out.println("test mail 4");
Address[] addresses = {abc};
System.out.println("test mail 5");
m.addRecipients(Message.RecipientType.TO, addresses);
System.out.println("test mail 6");
m.setContent("A message for you...");
System.out.println("test mail 7");
m.setSubject("Email for you");

}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("test mail 8");
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
System.out.println("test mail 9");
}

This is my code.

I see all the test mail until the 8.

So the problem is on the invoke

Any idea??
Offline  
Old 07-04-2008, 09:53 AM   #15
Ivanov
Talking BlackBerry Encyclopedia
 
Join Date: Apr 2008
Location: Germany, BW
Model: -
PIN: N/A
Carrier: -
Posts: 310
Default

actually both methods work for me:

Code:
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.*;
import net.rim.blackberry.api.invoke.*;
import net.rim.blackberry.api.mail.*;

public class GuiTest extends UiApplication {

	public GuiTest()
	{
		pushScreen(new MyScreen());
	}
	
	class MyScreen extends MainScreen{
		public MyScreen(){
			add(new LabelField("test"));
		}
		
	    private MenuItem _miMailInvoke = new MenuItem("invoke", 110, 10) {
	        public void run()
	        {
	        	Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(MessageArguments.ARG_NEW, "TO", "SUBJECT", "BODY"));
	        }
	    };
	    
	    private MenuItem _miMailInvoke2 = new MenuItem("invoke 2", 110, 10) {
	        public void run()
	        {
	    		Message m = new Message();
	    		Address a;
	    		try {
	    			a = new Address("mLi@rim.com", "Ming Li");
	    			Address[] addresses = {a};
	    			m.addRecipients(Message.RecipientType.TO, addresses);
	    			m.setContent("A message for you...");
	    			m.setSubject("Email for you");

	    		} catch (Exception e) {
	    			// TODO Auto-generated catch block
	    			e.printStackTrace();
	    		}

	    		Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(m));
	        }
	    };
	    
        protected void makeMenu(Menu menu, int instance)
        {
            menu.add( _miMailInvoke );
            menu.add( _miMailInvoke2 );
           
            super.makeMenu(menu, instance);
        }
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		GuiTest app = new GuiTest();
		app.enterEventDispatcher();
	}
}

Last edited by Ivanov; 07-04-2008 at 09:54 AM..
Offline  
Old 07-04-2008, 10:09 AM   #16
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

The first method work but on my screen I have on the top Compose SMS 137.

So when I will click on send it will send an email or a sms???
Offline  
Old 07-04-2008, 10:30 AM   #17
goulamass
Talking BlackBerry Encyclopedia
 
Join Date: Jan 2008
Location: France
Model: 8310
PIN: N/A
Carrier: Vodafone
Posts: 217
Default

So no problem.

I have only this sreen on my simulator and the right on the BB.

Thanks a lot.
Offline  
Closed Thread



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


Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod picture

Lot of 6 Vintage Apple Drawstring Bags For iPhone, Mac, Apple Watch, iPod

$45.00



Retro 1951 Apple Computer Logo 0.7mm Ballpoint Black Ink Pen Gold Barrel picture

Retro 1951 Apple Computer Logo 0.7mm Ballpoint Black Ink Pen Gold Barrel

$56.41



Vintage Red Apple Six Drawer Storage Organizer File Cabinet  picture

Vintage Red Apple Six Drawer Storage Organizer File Cabinet

$35.00



Vintage  Rainbow Logo Apple Post-It Sticky Notes 4

Vintage Rainbow Logo Apple Post-It Sticky Notes 4" Rare computer collectible

$39.99



VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED picture

VINTAGE 1994 Apple Black Toner Laser Writer Cartridge M 2473 G/A NEW SEALED

$25.95



Vintage Print Block “ Apple Corer Kitchen Tool “ Copper Face Block picture

Vintage Print Block “ Apple Corer Kitchen Tool “ Copper Face Block

$16.00







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