Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

View a PDF stored on internal memory

$
0
0

I am trying to work out how to view a PDF saved to the Internal Memory (my clients devices do not have SD card slots).

I can save the file but cannot then view it with my "Intent" due to the protection of internal memory. I use this code to try and open the file:

Java.IO.File file = new Java.IO.File("/data/data/SDroid.SDroid/files/pdf/test.pdf"); 
file.SetReadable(true);
Android.Net.Uri uri = Android.Net.Uri.FromFile(file); 
Intent intent = new Intent(Intent.ActionView); 
intent.SetDataAndType(uri, "application/pdf"); 
intent.SetFlags(ActivityFlags.NewTask); 
Application.Context.StartActivity(intent); 

This code works fine on a Gingerbread device but not on the newer Jellybean devices. Any ideas?


Viewing all articles
Browse latest Browse all 204402

Trending Articles