我正在尝试发送包含多个附件的电子邮件.
Intent emailIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"email1@email.com", "email2@email.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "The Subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "The Text");
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
emailIntent.setType("text/plain");
startActivity( Intent.createChooser(emailIntent, "Send Email Using: ") );
Run Code Online (Sandbox Code Playgroud)
当我使用gmail发送电子邮件时,这很有用,但如果我使用Nexus One上的电子邮件客户端发送电子邮件,它不会附加附件.它包含所有文本,主题等...但只是没有附件.我有的电子邮件帐户是一个交换帐户,如果这很重要...
我正在为我的应用添加NFC/Beam功能,我希望它尽可能自动地工作.我想摆脱发送者的"触摸光束"屏幕和接收器的"新标签扫描"屏幕.基本上,我希望它像在三星商业中一样工作!我在stackoverflow中读到似乎可能没有办法摆脱"Touch To Beam"屏幕,但我希望有人有一些更新的信息或知道如何删除接收器屏幕.谢谢!
我在SD卡上打开了一个文件.当有人安装SD卡时,它会崩溃我的应用程序.我正在尝试注册ACTION_MEDIA_EJECT广播事件,我收到了,但似乎我得到的太迟了.当我得到它时,它已经崩溃了我的应用程序.在崩溃我的应用程序之前有没有办法得到通知?
添加了一些非常简单的示例代码 当我这样做时,当我打开USB(MSC模式)时,它会崩溃服务.
Test.java
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try {
startService(new Intent(this, TestService.class));
bindService(new Intent(this, TestService.class), serviceConnection, Context.BIND_AUTO_CREATE);
} catch (Exception e) {
}
}
protected TestService testService;
private ServiceConnection serviceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
TestService.LocalBinder binder = (TestService.LocalBinder) service;
testService = binder.getService();
}
@Override
public void onServiceDisconnected(ComponentName name) {
testService = null;
}
};
Run Code Online (Sandbox Code Playgroud)
TestService.java
@Override
public void …Run Code Online (Sandbox Code Playgroud) android ×3
android-beam ×1
attachment ×1
email ×1
hce ×1
mount ×1
nfc ×1
nfc-p2p ×1
sd-card ×1