我必须通过单击我的应用程序中的电子邮件按钮或短信按钮发送电子邮件和短信。我尝试使用共享意图,但它显示电子邮件列表,gmail.facebook等。我不希望该列表出现只是只需单击一下,就可以通过电子邮件按钮向用户发送电子邮件。任何人都可以提供想法..
我也发布了我的代码..
public class SharecontentActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button sharingButton = (Button) findViewById(R.id.button_share);
sharingButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
shareIt();
}
});
}
private void shareIt() {
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Request from CMH");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, " ");
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
}