Я работаю над отправкой почты друзьям, но нижеприведенный код отправляется только один раз. После этого я не могу отправить почту снова. Пожалуйста, направляйте меня.Невозможно отправить почту на Android
package com.mkyong.android;
import android.app.Activity;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class SendEmailActivity extends Activity {
Button buttonSend;
ConnectionDetector cd;
Boolean isInternetPresent = false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
buttonSend = (Button) findViewById(R.id.buttonSend);
buttonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
cd = new ConnectionDetector(getApplicationContext());
isInternetPresent = cd.isConnectingToInternet();
if (isInternetPresent) {
new MyTask().execute();
} else {
Toast.makeText(getApplicationContext(), "Not Enabled",
Toast.LENGTH_LONG).show();
}
}
});
}
class MyTask extends AsyncTask<String, String, String> {
@Override
protected String doInBackground(String... params) {
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { "[email protected]" });
i.putExtra(android.content.Intent.EXTRA_SUBJECT, "subject of email");
i.putExtra(android.content.Intent.EXTRA_TEXT, "body of email");
i.setType("message/rfc822");
try {
startActivity(Intent.createChooser(i, "Send mail..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getApplicationContext(),
"There are no email clients installed.",
Toast.LENGTH_SHORT).show();
}
return null;
}
@Override
protected void onPostExecute(String result) {
}
}
}
Pls показать то, что код ошибки – Riandy
07-16 11: 47: 17,890: W/IInputConnectionWrapper (4384): getExtractedText неактивного InputConnection 07-16 11:47: 17.895: W/IInputConnectionWrapper (4384): getTextBeforeCursor on inactive InputConnection 07-16 11: 47: 17.895: W/IInputConnectionWrapper (4384): getTextAfterCursor on inactive InputConnection 07-16 11: 47: 17.895: W/IInputConnectionWrapper (4384) : getExtractedText on inactive InputConnection 07-16 11: 47: 17.895: W/IInputConnectionWrapper (4384): beginBatchEdit on inactive InputConnection 07-16 11: 47: 17.900: W/IInputConnection Wrapper (4384): endBatchEdit on inactive InputConnection – Giridharan
Моя проблема: я отправил почту три раза в учетную запись моих друзей, но после этого я не могу отправить почту. – Giridharan