I am a newbie in android development. This is my code for my app. I have been trying to make the button to initialize and email app intent but it's not working. I have shared my files below. Please help.
Android Manifest
<activity android:name=".ordernow" android:label="Order Details">
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
activity_ordernow.xml LAYOUT
<Button
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:textAllCaps="true"
android:id="@+id/email_form"
android:text="Get Quote"
android:onClick="getQuote" />
Ordernow.java
public void getQuote (View view){
String addresses = "omukiga@omukiga.com";
String subject = "Get Quote Online";
String body = "This is the body text for me";
//Compose email to send to Intraline
Intent intent = new Intent(Intent.ACTION_SENDTO);
//For only email apps to handle the information Also Experiment about using whatsapp
intent.setData(Uri.parse("mailto:"));
intent.putExtra(Intent.EXTRA_EMAIL, addresses);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_TEXT, body);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}
Please help me find the qlitch. A good gist from github with the correct lines of code would be appreicated besides the explanations.