我正在开发联系表格,以便将电子邮件发送到已修复的特定邮件 ID....请帮助我...
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
buttonSend = (Button) findViewById(R.id.buttonSend);
textTo = (EditText) findViewById(R.id.editTextTo);
textSubject = (EditText) findViewById(R.id.editTextSubject);
textMessage = (EditText) findViewById(R.id.editTextMessage);
buttonSend.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
String to = textTo.getText().toString();
String subject = textSubject.getText().toString();
String message = textMessage.getText().toString();
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"abcdk@gmail.com"});
email.putExtra(Intent.EXTRA_SUBJECT, "subject");
email.putExtra(Intent.EXTRA_TEXT, "message");
email.setType("text/plain");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
}
});
但它不工作......
08-14 09:11:21.559: E/ActivityThread(552): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d4ad38 that was originally bound here
08-14 09:11:21.559: E/ActivityThread(552): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d4ad38 that was originally bound here
08-14 09:11:21.559: E/ActivityThread(552): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
08-14 09:11:21.559: E/ActivityThread(552): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
08-14 09:11:21.559: E/ActivityThread(552): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
08-14 09:11:21.559: E/ActivityThread(552): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
08-14 09:11:21.559: E/ActivityThread(552): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
08-14 09:11:21.559: E/ActivityThread(552): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
08-14 09:11:21.559: E/ActivityThread(552): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
08-14 09:11:21.559: E/ActivityThread(552): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
08-14 09:11:21.559: E/ActivityThread(552): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
08-14 09:11:21.559: E/ActivityThread(552): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
08-14 09:11:21.559: E/ActivityThread(552): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
08-14 09:11:21.559: E/ActivityThread(552): at android.os.AsyncTask$2.call(AsyncTask.java:287)
08-14 09:11:21.559: E/ActivityThread(552): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
08-14 09:11:21.559: E/ActivityThread(552): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
08-14 09:11:21.559: E/ActivityThread(552): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
08-14 09:11:21.559: E/ActivityThread(552): at java.lang.Thread.run(Thread.java:856)
08-14 09:11:21.620: E/StrictMode(552): null
08-14 09:11:21.620: E/StrictMode(552): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d4ad38 that was originally bound here
08-14 09:11:21.620: E/StrictMode(552): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
08-14 09:11:21.620: E/StrictMode(552): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
08-14 09:11:21.620: E/StrictMode(552): at android.app.ContextImpl.bindService(ContextImpl.java:1418)
08-14 09:11:21.620: E/StrictMode(552): at android.app.ContextImpl.bindService(ContextImpl.java:1407)
08-14 09:11:21.620: E/StrictMode(552): at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
08-14 09:11:21.620: E/StrictMode(552): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
08-14 09:11:21.620: E/StrictMode(552): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
08-14 09:11:21.620: E/StrictMode(552): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
08-14 09:11:21.620: E/StrictMode(552): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
08-14 09:11:21.620: E/StrictMode(552): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
08-14 09:11:21.620: E/StrictMode(552): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
08-14 09:11:21.620: E/StrictMode(552): at android.os.AsyncTask$2.call(AsyncTask.java:287)
08-14 09:11:21.620: E/StrictMode(552): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
08-14 09:11:21.620: E/StrictMode(552): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
08-14 09:11:21.620: E/StrictMode(552): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
08-14 09:11:21.620: E/StrictMode(552): at java.lang.Thread.run(Thread.java:856)