你好我做了序列化的目标文件,我想通过它发送它,messenger,gmail,短信等。我试图用这种方式发送它,这是从保存到发送的代码。我知道没有任何应用程序与此连接。通过其他应用程序发送序列化文件
File file=new File(getFilesDir() + "ShoppingList.ur");
try{
FileOutputStream fileOutputStream =new FileOutputStream(file);
ObjectOutputStream data=new ObjectOutputStream(fileOutputStream);
data.writeObject(toShare);
data.close();
fileOutputStream.close();
}catch(IOException e){
e.printStackTrace();
}
uriToSend=Uri.fromFile(file);
Intent shareIntent=new Intent(Intent.ACTION_SENDTO);
shareIntent.addCategory("*/*");
shareIntent.putExtra(Intent.EXTRA_STREAM,uriToSend);
startActivity(Intent.createChooser(shareIntent,getString(R.string.sendTo)));
file.delete();