1. 下载创建本地应用内文件时,创建模式必须为 FileCreationMode.WorldReadable
Stream fos = OpenFileOutput(pdfName, FileCreationMode.WorldReadable);
using (fos)
{
fos.Write(fileBytes,0,fileBytes.Length);
}
2. 调用pdf 应用打开pdf文件
Java.IO.File pdfFile = Application.Context.GetFileStreamPath(pdfName);
if (pdfFile.Exists())
{
Android.Net.Uri path = Android.Net.Uri.FromFile(pdfFile);
Intent intent = new Intent(Intent.ActionView);
intent.SetDataAndType(path, "application/pdf");
intent.SetFlags(ActivityFlags.NewTask);
try
{
Application.Context.StartActivity(intent);
}
catch (ActivityNotFoundException ex)
{
System.Diagnostics.Debug.WriteLine("no app installed to view the pdf");
}
}
3. 使用VideoView播放视频
videoView.SetVideoPath(internalPath);
videoView.Start();
参考:
http://www.voidcn.com/article/p-sjfkimpu-btb.html