0
如何在BlackBerry SDK 6中將音頻文件作爲附件發送?如何在BlackBerry中發送音頻文件作爲附件?
如何在BlackBerry SDK 6中將音頻文件作爲附件發送?如何在BlackBerry中發送音頻文件作爲附件?
您可以將audiofile的轉換到ByteArray,然後用下面的方法
public synchronized boolean sendMail(final byte []data,
final boolean licensed)
{
Folder[] folders = store.list(4);
Folder sentfolder = folders[0];
// create a new message and store it in the sent folder
msg = new Message(sentfolder);
multipart = new Multipart();
textPart = new TextBodyPart(multipart,"Audio");
Address recipients[] = new Address[1];
try {
recipients[0] = new Address(address, "XYZ");
msg.addRecipients(Message.RecipientType.TO, recipients);
msg.setSubject("Audio");
try {
Thread thread = new Thread("Send mail") {
public void run() {
emailSenderIsBusy = true;
try {
attach = new SupportedAttachmentPart(
multipart, "application/octet-stream",
"title",data);
multipart.addBodyPart(textPart);
multipart.addBodyPart(attach);
msg.setContent(multipart);
Transport.send(msg);
}
catch(SendFailedException e)
{
}
catch (final MessagingException e) {
}
catch (final Exception e) {
}
}
};
thread.start();
return true;
}
catch (final Exception e)
{
}
}catch (final Exception e) {
}
return false;
}
如何從音頻文件獲得字節? – Signare 2012-04-18 13:22:27