我有一个连接到解析服务器数据的ListView正在通过解析。当我单击ListView的单个项目时,它转到单个项目视图。我有一个电子邮件按钮,我需要的是当我点击该电子邮件按钮和电子邮件客户端应该打开。具有该特定的单项电子邮件ID。电子邮件ID存储在解析数据库的列中。任何人都知道请告诉如何做到这一点?
我的数据库是解析服务器,我需要动态地从电子邮件中获取电子邮件 解析列。每个单项都有不同的电子邮件...电子邮件列 名称是“电子邮件”
*
我在下面使用了一个答案并进行了如下编辑,但未显示接收者电子邮件
*
btn1 = (Button)findViewById(R.id.button5);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String phnoo = object.getString("email");
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("message/rfc822");
intent.setData(Uri.parse("mailto:"+phnoo));
startActivity(intent);
我调用电子邮件客户端的java代码
btn1 = (Button) findViewById(R.id.button5) ;
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String phno="email";
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri data = Uri.parse("mailto:" +phno);
intent.setData(data);
startActivity(intent);
}
});
按钮的
<Button
android:id="@+id/button5"
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="E-MAIL"
android:layout_weight="1"
android:background="#EFEFEF"/>
答案 0 :(得分:3)
试试这个
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{ emailAddress });
i.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
i.putExtra(android.content.Intent.EXTRA_TEXT, text);
startActivity(Intent.createChooser(i, "Send email"));
答案 1 :(得分:2)
我认为这会对你有帮助
// slide to top of the page
$('.up').click(function () {
$("html, body").animate({
scrollTop: 0
}, 600);
return false;
});
// slide page to anchor
$('.menutop b').click(function(){
//event.preventDefault();
$('html, body').animate({
scrollTop: $( $(this).attr('href') ).offset().top
}, 600);
return false;
});
// Scroll to class, div
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#target-element").offset().top
}, 1000);
});
// div background animate
$(window).scroll(function () {
var x = $(this).scrollTop();
// freezze div background
$('.banner0').css('background-position', '0px ' + x +'px');
// from left to right
$('.banner0').css('background-position', x+'px ' +'0px');
// from right to left
$('.banner0').css('background-position', -x+'px ' +'0px');
// from bottom to top
$('#skills').css('background-position', '0px ' + -x + 'px');
// move background from top to bottom
$('.skills1').css('background-position', '0% ' + parseInt(-x / 1) + 'px' + ', 0% ' + parseInt(-x / 1) + 'px, center top');
// Show hide mtop menu
if ( x > 100 ) {
$( ".menu" ).addClass( 'menushow' );
$( ".menu" ).fadeIn("slow");
$( ".menu" ).animate({opacity: 0.75}, 500);
} else {
$( ".menu" ).removeClass( 'menushow' );
$( ".menu" ).animate({opacity: 1}, 500);
}
});
// progres bar animation simple
$('.bar1').each(function(i) {
var width = $(this).data('width');
$(this).animate({'width' : width + '%' }, 900, function(){
// Animation complete
});
});
答案 2 :(得分:1)
尝试以下
private void sendEmail(File file){
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("text/html");
final PackageManager pm = this.getPackageManager();
final List<ResolveInfo> matches = pm.queryIntentActivities(emailIntent, 0);
String className = null;
for (final ResolveInfo info : matches) {
if (info.activityInfo.packageName.equals("com.google.android.gm")) {
className = info.activityInfo.name;
if(className != null && !className.isEmpty()){
break;
}
}
}
emailIntent.setClassName("com.google.android.gm", className);
emailIntent.setType("vnd.android.cursor.dir/email");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Subject");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{"xyz@abc.com"});
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
emailIntent.setType("plain/text");
startActivity(emailIntent);
}