안녕하세요 Android 개발이 처음이며 문제가 발생했습니다. 나는 http://www.youtube.com/watch?v=Sqk154QSe8Y#t=158 (뉴 보스턴) 에서이 튜토리얼 비디오를 뭐라고하는데, 내가 똑같은 정확한 코드를 가지고 있다고 말할 수있는 한 어떤 이유에서인지 코드는 버튼 탭과 Intent 호출에서 이메일 앱을 열지 않습니다.
Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "I hate you");
emailIntent.setType("plain/type");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
텍스트 색상을 변경할 수 있지만 이메일 의도가 열리지 않기 때문에 버튼이 작동합니다.
내가 뭔가 잘못하고 있습니까 ??
이것은 완전한 코드입니다 ---
com.infitenothing.word 패키지;
import com.infitenothing.dogcat.R;
import android.R.anim;
import android.R.layout;
import android.app.Activity;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.os.Bundle;
import android.text.Layout;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Email extends Activity implements View.OnClickListener {
EditText personsEmail, intro, personsName, stupidThings, hatefulAction,
outro;
String emailAdd, beginning, name, stupidAction, hatefulAct, out;
Button sendEmail;
TextView color;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.email);
initializeVars();
sendEmail.setOnClickListener(this);
}
private void initializeVars() {
// TODO Auto-generated method stub
personsEmail = (EditText) findViewById(R.id.etEmails);
intro = (EditText) findViewById(R.id.etIntro);
personsName = (EditText) findViewById(R.id.etName);
stupidThings = (EditText) findViewById(R.id.etThings);
hatefulAction = (EditText) findViewById(R.id.etAction);
outro = (EditText) findViewById(R.id.etOutro);
sendEmail = (Button) findViewById(R.id.bSentEmail);
color = (TextView) findViewById(R.id.colors);
}
public void onClick(View v) {
// TODO Auto-generated method stub
color.setTextColor(Color.RED);
convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated();
String emailaddress[] = { emailAdd };
String message = "Well hello "
+ name
+ " I just wanted to say "
+ beginning
+ ". Not only that but I hate when you "
+ stupidAction
+ ", that just really makes me crazy. I just want to make you "
+ hatefulAct
+ ". Welp, thats all I wanted to chit-chatter about, oh and"
+ out
+ ". Oh also if you get bored you should check out www.mybringback.com"
+ '\n' + "PS. I think I love you... :(";
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
//Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, emailaddress);
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "I hate you");
emailIntent.setType("plain/type");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
}
private void convertEditTextVarsIntoStringsAndYesThisIsAMethodWeCreated() {
// TODO Auto-generated method stub
emailAdd = personsEmail.getText().toString();
beginning = intro.getText().toString();
name = personsName.getText().toString();
stupidAction = stupidThings.getText().toString();
hatefulAct = hatefulAction.getText().toString();
out = outro.getText().toString();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
finish();
}
}
인 텐트를 만들었지 만 실행 신호를 보내지 않았습니다. 이 코드 추가 :
startActivity(Intent.createChooser(emailIntent, "Send Email"));
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다