我有下面的代碼,它只是打開我的gmail的郵件發送屏幕,我不想那樣。 其實我想在onClick
期間發送即時郵件給郵件標識。 這可能嗎?幫助please.Thanks提前。 我是否需要添加任何權限?在Onclick期間自動發送郵件到[email protected] ,,,,,
package com.example.emails;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class Emails extends Activity {
private static Button email;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_emails);
email= (Button)findViewById(R.id.button1);
email.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{ "[email protected]"});
//email.putExtra(Intent.EXTRA_CC, new String[]{ to});
//email.putExtra(Intent.EXTRA_BCC, new String[]{to});
email.putExtra(Intent.EXTRA_SUBJECT, "new mail");
email.putExtra(Intent.EXTRA_TEXT, "hello");
//need this to prompts email client only
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Choose an Email client :"));
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.emails, menu);
return true;
}
}
正在開發Android應用程序,,,在應用程序註冊畫面,,,後 註冊過程完成,,,我想送電子郵件提醒管理員,, admin @ gmail.com ,,, –