prasana venkat
prasana venkat

Reputation: 19

mailto URI parse in android

I have a button that sends feedback. In the emulator it currently says "Unable to perform this operation". Will my app say this in the real device too ? If so what is the workaround to implementing mailto function ? i did see this page but I can not implement a webView in my MainActivity

    Button btn2 = (Button)findViewById(R.id.feedback);
    btn2.setOnClickListener(new OnClickListener(){
        public void onClick(View v) {
            Uri address = Uri.parse("mailto:[email protected]?subject=calculator_feedback");
            Intent i = new Intent(Intent.ACTION_VIEW,address);
            startActivity(i);
        }
        });

Upvotes: 0

Views: 5645

Answers (1)

user377628
user377628

Reputation:

You can use the code from the link you posted. I haven't tried it, but I don't see why it wouldn't work:

Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(Intent.EXTRA_EMAIL, new String[]{ "[email protected]" });
i.putExtra(Intent.EXTRA_SUBJECT, "calculator_feedback");
startActivity(i);

Let me know if that worked.

Upvotes: 3

Related Questions