我有一個XML文件,用戶將輸入一個電子郵件到它,那麼當點擊提交按鈕,我希望應用程序的具體內容,該電子郵件自動發送電子郵件。 。點擊按鈕即可全自動發送電子郵件在android系統
任何好的教程或例子我可以從中獲得幫助?
package com.example.emailtest;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class main extends Activity{
public Button bsend;
public Mail m;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
bsend=(Button) findViewById(R.id.button1);
bsend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
Mail mail = new Mail();
try {
mail.send();
} catch (Exception e) {
e.printStackTrace();
}}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
logcat的
12-13 02:22:51.831: W/dalvikvm(2588): Unable to resolve superclass of Lcom/example/emailtest/Mail; (820)
12-13 02:22:51.831: W/dalvikvm(2588): Link of class 'Lcom/example/emailtest/Mail;' failed
12-13 02:22:51.831: E/dalvikvm(2588): Could not find class 'com.example.emailtest.Mail', referenced from method com.example.emailtest.MainActivity$1.onClick
12-13 02:22:51.831: W/dalvikvm(2588): VFY: unable to resolve new-instance 711 (Lcom/example/emailtest/Mail;) in Lcom/example/emailtest/MainActivity$1;
12-13 02:22:51.841: D/dalvikvm(2588): VFY: replacing opcode 0x22 at 0x0000
12-13 02:22:51.841: W/dalvikvm(2588): Unable to resolve superclass of Lcom/example/emailtest/Mail; (820)
12-13 02:22:51.841: W/dalvikvm(2588): Link of class 'Lcom/example/emailtest/Mail;' failed
12-13 02:22:51.841: D/dalvikvm(2588): DexOpt: unable to opt direct call 0x13b3 at 0x02 in Lcom/example/emailtest/MainActivity$1;.onClick
12-13 02:22:52.101: D/gralloc_goldfish(2588): Emulator without GPU emulation detected.
12-13 02:22:54.681: D/AndroidRuntime(2588): Shutting down VM
12-13 02:22:54.681: W/dalvikvm(2588): threadid=1: thread exiting with uncaught exception (group=0xb4acab90)
12-13 02:22:54.701: E/AndroidRuntime(2588): FATAL EXCEPTION: main
12-13 02:22:54.701: E/AndroidRuntime(2588): Process: com.example.emailtest, PID: 2588
12-13 02:22:54.701: E/AndroidRuntime(2588): java.lang.NoClassDefFoundError: com.example.emailtest.Mail
12-13 02:22:54.701: E/AndroidRuntime(2588): at com.example.emailtest.MainActivity$1.onClick(MainActivity.java:22)
12-13 02:22:54.701: E/AndroidRuntime(2588): at android.view.View.performClick(View.java:4424)
12-13 02:22:54.701: E/AndroidRuntime(2588): at android.view.View$PerformClick.run(View.java:18383)
12-13 02:22:54.701: E/AndroidRuntime(2588): at android.os.Handler.handleCallback(Handler.java:733)
12-13 02:22:54.701: E/AndroidRuntime(2588): at android.os.Handler.dispatchMessage(Handler.java:95)
12-13 02:22:54.701: E/AndroidRuntime(2588): at android.os.Looper.loop(Looper.java:137)
12-13 02:22:54.701: E/AndroidRuntime(2588): at android.app.ActivityThread.main(ActivityThread.java:4998)
12-13 02:22:54.701: E/AndroidRuntime(2588): at java.lang.reflect.Method.invokeNative(Native Method)
12-13 02:22:54.701: E/AndroidRuntime(2588): at java.lang.reflect.Method.invoke(Method.java:515)
12-13 02:22:54.701: E/AndroidRuntime(2588): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
12-13 02:22:54.701: E/AndroidRuntime(2588): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
12-13 02:22:54.701: E/AndroidRuntime(2588): at dalvik.system.NativeStart.main(Native Method)
12-13 02:22:58.121: I/Process(2588): Sending signal. PID: 2588 SIG: 9
@gruszczy不是說用戶如何從應用程序發送電子郵件?我希望應用程序自動發送電子郵件給用戶 –