I want to open an email application on my Android app: The following code is crashing, am I doing something wrong? Please provide code
intent = new intent (Intent.ACTION_SEND, Uri.fromParts ("mailto", "testemail@gmail.com", tap)); This.startActivity (i);
/ * create intent * / last intent emailintent = new intent (android .content.Intent.ACTION_SEND); / * Fill it with data * / emailIntent.setType ("plain / text"); EmailIntent.putExtra (android.content.Intent.EXTRA_EMAIL, new string [] {"to@email.com"}); EmailIntent.putExtra (android.content.Intent.EXTRA_SUBJECT, "topic"); EmailIntent.putExtra (android.content.Intent.EXTRA_TEXT, "text"); / * Send it for activity-chaucer * / reference. Initial Activity (Intent.createChooser (Email Intent, "Send Mail ...")); Try it out, it's a bit more clear. Yet the intent for email only works if you are using an application in a real phone, so if you are using the emulator, then try it on an actual phone.
Comments
Post a Comment