Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7688971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:03:19+00:00 2026-05-31T20:03:19+00:00

In my application i want send a email to one account.in one button click

  • 0

In my application i want send a email to one account.in one button click event.i used the below code . this have exception

public void onClick(View v) {
             sendEmail(context, new String[]{"jayampalaniraja@gmail.com"}, "Sending Email", "Test Email", "I am body");
        }

        private void sendEmail(Context context, String[] recipientList,
                String subject, String body, String title) {
            Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
            emailIntent.setType("plain/text");
            emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, recipientList);
            emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
            emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body);
            emailIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);

            try
            {
            context.startActivity(Intent.createChooser(emailIntent, title));

            }catch(Exception e)
            {
                System.out.println(e);
            }   
        }

The exception I am getting as

 "03-19 19:13:19.553: I/System.out(2010): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag.
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:03:20+00:00Added an answer on May 31, 2026 at 8:03 pm

    It’s working fine. first thing to configure a email client for your emulator.enter code here

    public void onClick(View v) {
    
                // TODO Auto-generated method stub
    
                Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    
                String aEmailList[] = { "pal@Yahoo.co.in" };
                //String aEmailCCList[] = { ""};
                //String aEmailBCCList[] = { "" };
    
                emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, aEmailList);
                //emailIntent.putExtra(android.content.Intent.EXTRA_CC, aEmailCCList);
                //emailIntent.putExtra(android.content.Intent.EXTRA_BCC, aEmailBCCList);
    
                emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "My subject");
    
                emailIntent.setType("message/rfc822");
                emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "My message body.");
                   try
                   {
                startActivity(emailIntent);
                   }catch (android.content.ActivityNotFoundException ex) {
                    Toast.makeText(about.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
                }
    
    
                   catch(Exception e){ System.out.println(e);}
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to write application who send email using outlook and i found this
I want to create one application which send email with attachment(select file from SD
I have developed one application which used to send/receive mails using Exchange Server 2003
I want to send an email from within my iPhone application, primarily because i
I want to send my Application to background simply clicking on Button inside my
I am developing a GWT application and I want to send an Email via
I have used an open source code from CodeProject to read email from incoming
I have written some simple code, to send en auto generated email, using the
I have made one application for epaper/emagazine in which I want to give an
In my application i want to send email to multiple recipients. i am able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.