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 8434085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:33:43+00:00 2026-06-10T06:33:43+00:00

I am trying to create an application where you can take a picture and

  • 0

I am trying to create an application where you can take a picture and then email it to someone. At the moment I can take a picture and set my background as this picture:

public class Camera extends Activity implements View.OnClickListener{


ImageButton ib;
Button b;
ImageView iv;
Intent i;
final static int cameraData = 0;
Bitmap bmp;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.photo);
    initialize();
    InputStream is = getResources().openRawResource(R.drawable.ic_launcher);
    bmp = BitmapFactory.decodeStream(is);
}

private void initialize(){
    ib = (ImageButton) findViewById(R.id.ibTakePic);
    b = (Button) findViewById(R.id.bSetWall);
    iv = (ImageView) findViewById(R.id.ivReturnedPic);
    b.setOnClickListener(this);
    ib.setOnClickListener(this);



}

@Override
public void onClick(View v) {
    File mImageFile;
    // TODO Auto-generated method stub
    switch(v.getId()){
    case R.id.bSetWall:
        try {
            getApplicationContext().setWallpaper(bmp);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    break;
    case R.id.ibTakePic:
        i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(i, cameraData);
    break;
    }

}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode == RESULT_OK){
        Bundle extras = data.getExtras();
        bmp = (Bitmap)extras.get("data");
        iv.setImageBitmap(bmp);
    }
}




}

I have a separate application where I can take in user input and email it to a predefined address:

    public void onClick(View v) {
    // TODO Auto-generated method stub
    convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated();
    String emailaddress[] = { "info@sklep.com", "", };
    String message = emailAdd + name + beginning;

    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress);

    emailIntent.setType("plain/text");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
    startActivity(emailIntent);

}

How do I go about emailing the picture that I have taken? Where is it saved and how do I access it so that I can email it?

Many Thanks

  • 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-06-10T06:33:44+00:00Added an answer on June 10, 2026 at 6:33 am
     @Override
        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
            // TODO Auto-generated method stub
            super.onActivityResult(requestCode, resultCode, data);
            if(resultCode == RESULT_OK){
        File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
                    File output = new File(dir, "camerascript.png");
                    cPath = output.getAbsolutePath();
                    Bitmap b =  BitmapFactory.decodeFile(cPath);
                    Bitmap out = Bitmap.createScaledBitmap(b, 320, 480, false);
                    FileOutputStream fout;
                    try{
                        fout = new FileOutputStream(output);
                        out.compress(Bitmap.CompressFormat.PNG, 100, fout);
                        fout.flush();
                        fout.close();
                        b.recycle();
                        out.recycle();
                    }catch(Exception e){
                        e.printStackTrace();
                    }
    
            }
        }
    

    after that in your sending mail method

    public void sendMail(){
            Log.e("sendMail", "v r in sendMail");
    
            i = new Intent(Intent.ACTION_SEND);
            i.setType("plain/text");
                i.putExtra(Intent.EXTRA_EMAIL, new String[] {"abc@gmail.com"});
              i.putExtra(Intent.EXTRA_SUBJECT,"subject...");
            i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(cPath));
            i.putExtra(Intent.EXTRA_TEXT, "Body of Email....");
            startActivityForResult(Intent.createChooser(i, "send mail...."),EMAIL_SUCCESS);
    
        }
    

    above code will help u..

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

Sidebar

Related Questions

I am trying to create an application can modify properties in IL to create
I'm trying to create an objective C classe for my iPad application which can
I am trying to create an iPhone application where the user can add entries.
Im trying to create application from scratch. In new maven project i add a
I am trying to create an application compatible with both retina and non-retina displays.
I am trying to create BB application that features the in-app purchase. I followed
I am trying to create an application that makes a window (external to the
I'm trying to create an application where there is a JSplitPane which contains the
I'm trying to create an application that uses the iPhone MapView (under Google Code).
I'm trying to create an application in interface builder, and I'm having a problem.

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.