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

  • Home
  • SEARCH
  • 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 7620949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:04:28+00:00 2026-05-31T04:04:28+00:00

In my app, i have a customize dialog from where i am getting the

  • 0

In my app, i have a customize dialog from where i am getting the user input as textedit, sppiner, datepicker. I also have a “send” button there in the dialog. I want that after filling the fields in the dialog as soon the user presses on send button the data he/she might have filled there should get bundled as a .csv and get attached to the email and get sent through an email directly without opening the default email screen.

Any help will highly be appreciated.

mrana

  • 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-31T04:04:29+00:00Added an answer on May 31, 2026 at 4:04 am

    Get the data from your EditText, Spinner, and DatePicker and store it in a String using the desired delimiter for your csv (e.g., comma, semicolon, tab, space, etc.).

    Next save the file and then use Intent.Action_SEND along with Intent.CreateChooser to send the file as an attachment. If your file is stored internally (i.e., it’s private) then you also need to use a ContentProvider (see this link).

    Here’s an example:

    //For simplicity's sake let's say you have three methods 
    //to get the value of your EditText, Spinner, 
    //and DatePicker and these methods return a String
    
    String editTextValue = getEditTextValue();
    String spinnerTextValue = getSpinnerTextValue();
    String datePickerTextValue = getDPTextValue();
    
    //Create a String in csv format with the String values obtained 
    //from the above fictitious methods. The delimiter in this case is the semicolon ";"
    
    String myFileContentString = editTextValue + ";" + 
    spinnerTextValue + ";" + 
    datePickerTextValue + "\n";
    
    //Save file to internal storage
    
    FileOutputStream fos = openFileOutput("myfilename.csv", Context.MODE_WORLD_WRITEABLE);
    fos.write(myFileContentString.getBytes());
    fos.close();
    
    //Send the file as an attachment
    
    final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "A CSV File");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "See attachment...");
    emailIntent.putExtra(android.content.Intent.EXTRA_STREAM, 
    Uri.parse("content://" + MyContentProviderClass.AUTHORITY + "/" + "myfilename.csv"));
    startActivity(Intent.createChooser(emailIntent, "Send mail..."));
    

    Don’t forget to catch exceptions with try/catch

    You will need to subclass a ContentProvider class and override the openFile method. See the links here and here for how to implement your own content provider.

    In your ContentProvider subclass, you will want something like the following in the openFile method:

    String fileLocation = getContext().getFilesDir() + File.separator + "myfilename.csv";
    
    ParcelFileDescriptor pfd = ParcelFileDescriptor.open(new File(fileLocation),
    ParcelFileDescriptor.MODE_READ_ONLY);
    
    return pfd;
    

    And don’t forget to update your AndroidManifest.xml with:

    <provider android:name="my.package.content.provider.Class" 
    android:authorities="my.package.content.provider"></provider></application>
    

    The provider declaration in the manifest file goes within the application declaration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my app that have some tab's (tabbar). In the first tab, there
I've created a UIDatePicker in my app and I also have support for several
I have a Facelets(JSF 1.2 (myfaces)) web app and I want to customize my
I have an iphone App that reads the category field from the xml file
I have been happily refactoring code from different versions of the same app (paid/free)
I have an events app which gets events data from sqlite database and displays
I have a Rails 3 App using devise. I want to create a User/Profile
In my app i have a slider which i need to customize. I have
I have a Universal App in which I customize my UINavigationBar. In my iPhone
In my app, i have customize UITableViewCell and is using its contentView property. But

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.