Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying the To address prefilled in Email Intent?

enter image description hereI am not able to pre fill the TO field in Email client to the "to" address mentioned in the extras here:

EmailImage.setOnClickListener(new OnClickListener() {  
            @Override  
            public void onClick(View v) {  
                 // TODO Auto-generated method stub  
                Intent it = new Intent(Intent.ACTION_SEND_MULTIPLE);   
                it.putExtra(Intent.EXTRA_EMAIL, "[email protected]");   
                it.putExtra(Intent.EXTRA_SUBJECT, "Regarding Policy Info");  
                it.putExtra(Intent.EXTRA_TEXT, "When is my next Premium due");  
                //it.setType("text/plain");   
                it.setType("message/rfc822");  
                startActivity(it);   
            }  
        });  

What is the problem?

Thanks
Sneha

like image 582
Smitha Avatar asked Feb 13 '12 11:02

Smitha


1 Answers

You need to put the address in an array:

it.putExtra(Intent.EXTRA_EMAIL, new String[] {"[email protected]"});

See here.

like image 120
MByD Avatar answered Sep 27 '22 20:09

MByD