Hello everyone. I am new to Android programming. I have a method for sending a mail destination with GPS status. I have one button if the user clicks this button, if I have a function to check the GPS status. and send e-mail, but sending e-mail intent does not work, and this error is displayed in LogCat.
07-16 16:23:30.161: E/AndroidRuntime(28567): FATAL EXCEPTION: main 07-16 16:23:30.161: E/AndroidRuntime(28567): java.lang.IllegalStateException: Could not execute method of the activity 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.view.View$1.onClick(View.java:3735) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.view.View.performClick(View.java:4354) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.view.View$PerformClick.run(View.java:17961) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.os.Handler.handleCallback(Handler.java:725) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.os.Handler.dispatchMessage(Handler.java:92) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.os.Looper.loop(Looper.java:137) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.app.ActivityThread.main(ActivityThread.java:5328) 07-16 16:23:30.161: E/AndroidRuntime(28567): at java.lang.reflect.Method.invokeNative(Native Method) 07-16 16:23:30.161: E/AndroidRuntime(28567): at java.lang.reflect.Method.invoke(Method.java:511) 07-16 16:23:30.161: E/AndroidRuntime(28567): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102) 07-16 16:23:30.161: E/AndroidRuntime(28567): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) 07-16 16:23:30.161: E/AndroidRuntime(28567): at dalvik.system.NativeStart.main(Native Method) 07-16 16:23:30.161: E/AndroidRuntime(28567): Caused by: java.lang.reflect.InvocationTargetException 07-16 16:23:30.161: E/AndroidRuntime(28567): at java.lang.reflect.Method.invokeNative(Native Method) 07-16 16:23:30.161: E/AndroidRuntime(28567): at java.lang.reflect.Method.invoke(Method.java:511) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.view.View$1.onClick(View.java:3730) 07-16 16:23:30.161: E/AndroidRuntime(28567): ... 11 more 07-16 16:23:30.161: E/AndroidRuntime(28567): Caused by: java.lang.IllegalArgumentException: Plain text must be supplied if HTML text is supplied 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.content.ClipData$Item.<init>(ClipData.java:252) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7253) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.content.Intent.migrateExtraStreamToClipData(Intent.java:7234) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1428) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.app.Activity.startActivityForResult(Activity.java:3430) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.app.Activity.startActivityForResult(Activity.java:3391) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:817) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.app.Activity.startActivity(Activity.java:3626) 07-16 16:23:30.161: E/AndroidRuntime(28567): at android.app.Activity.startActivity(Activity.java:3594) 07-16 16:23:30.161: E/AndroidRuntime(28567): at com.mpa.emvi.HomeActivity.sendEmail(HomeActivity.java:100) 07-16 16:23:30.161: E/AndroidRuntime(28567): ... 14 more
OK In My HomActivityClass
package com.mpa.emvi; import com.mpa.emvi.R; import android.support.v4.app.FragmentActivity; import android.util.Log; import android.view.View; import android.widget.Toast; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks; import com.google.android.gms.common.GooglePlayServicesClient.OnConnectionFailedListener; import com.google.android.gms.location.LocationClient; import com.google.android.gms.location.LocationListener; import android.content.Context; import android.content.Intent; import android.location.Location; import android.location.LocationManager; import android.os.Bundle; public class HomeActivity extends FragmentActivity implements ConnectionCallbacks, OnConnectionFailedListener, LocationListener { private LocationManager mLocationManager; boolean statusOfGPS; private GoogleMap mMap; private LocationClient mLocationClient; private String DescribText = new String(); private static final String TAG = "MyGPS_status"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); } @Override protected void onResume() { super.onResume(); setUpMapIfNeeded(); setUpLocationClientIfNeeded(); mLocationClient.connect(); mLocationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE ); } private void setUpMapIfNeeded() {
Send an email using intent in the sendEmail method, why does this work?
PS my english skill is bad and thanks for any answers.
source share