Roberto P. Well-Known Member Licensed User Longtime User Jul 1, 2015 #1 I can not open a pdf file in the folder File.DirAssets & "/products/product.pdf, there is an error or you can not open a file in that folder? Code: Copy Dim In As Intent In.Initialize(In.ACTION_VIEW, "file://" & aFile) In.SetType("application/pdf") In.SetComponent("android/com.android.internal.app.ResolverActivity") StartActivity(In)
I can not open a pdf file in the folder File.DirAssets & "/products/product.pdf, there is an error or you can not open a file in that folder? Code: Copy Dim In As Intent In.Initialize(In.ACTION_VIEW, "file://" & aFile) In.SetType("application/pdf") In.SetComponent("android/com.android.internal.app.ResolverActivity") StartActivity(In)
walterf25 Expert Licensed User Longtime User Jul 1, 2015 #2 Roberto P. said: I can not open a pdf file in the folder File.DirAssets & "/products/product.pdf, there is an error or you can not open a file in that folder? Code: Copy Dim In As Intent In.Initialize(In.ACTION_VIEW, "file://" & aFile) In.SetType("application/pdf") In.SetComponent("android/com.android.internal.app.ResolverActivity") StartActivity(In) Click to expand... I don't think you can open a file from the File.DirAssets folder, you may want to copy the file to either the internal folder or your package name folder. Cheers, Walter Upvote 0
Roberto P. said: I can not open a pdf file in the folder File.DirAssets & "/products/product.pdf, there is an error or you can not open a file in that folder? Code: Copy Dim In As Intent In.Initialize(In.ACTION_VIEW, "file://" & aFile) In.SetType("application/pdf") In.SetComponent("android/com.android.internal.app.ResolverActivity") StartActivity(In) Click to expand... I don't think you can open a file from the File.DirAssets folder, you may want to copy the file to either the internal folder or your package name folder. Cheers, Walter
Erel B4X founder Staff member Licensed User Longtime User Jul 2, 2015 #4 It must be copied to the "external storage" (File.DirRootExternal or DirDefaultExternal). Other apps cannot access internal folders or the assets folder. Upvote 0
It must be copied to the "external storage" (File.DirRootExternal or DirDefaultExternal). Other apps cannot access internal folders or the assets folder.
Roberto P. Well-Known Member Licensed User Longtime User Jul 2, 2015 #5 copying the files in other directories can read the pdf file. I do not understand why can read images, html files but not read pdf file ?! thanks Upvote 0
copying the files in other directories can read the pdf file. I do not understand why can read images, html files but not read pdf file ?! thanks
DonManfred Expert Licensed User Longtime User Jul 2, 2015 #6 Roberto P. said: I do not understand why can read images, html files but not read pdf file ?! Click to expand... That´s the point. YOU (your app) can read the files from your assets. No matter what type of files. But with the intent you start ANOTHER app which should show the file. This app do need access to your Assets or Internal files to read the file but it hasnt this permission. So; if you relay on an external app the files should be copied to a place where the external app has access to this file. No matter if it is an Image, Textfile, PDF or whatever. Upvote 0
Roberto P. said: I do not understand why can read images, html files but not read pdf file ?! Click to expand... That´s the point. YOU (your app) can read the files from your assets. No matter what type of files. But with the intent you start ANOTHER app which should show the file. This app do need access to your Assets or Internal files to read the file but it hasnt this permission. So; if you relay on an external app the files should be copied to a place where the external app has access to this file. No matter if it is an Image, Textfile, PDF or whatever.
Roberto P. Well-Known Member Licensed User Longtime User Jul 2, 2015 #7 thanks DonManfred clear. So if I wanted to open the pdf file without an intent I would have no problems? As I read the html file with File object. Upvote 0
thanks DonManfred clear. So if I wanted to open the pdf file without an intent I would have no problems? As I read the html file with File object.
DonManfred Expert Licensed User Longtime User Jul 2, 2015 #8 Roberto P. said: So if I wanted to open the pdf file without an intent I would have no problems? Click to expand... YOUR app must read and show the pdf then. Upvote 0
Roberto P. said: So if I wanted to open the pdf file without an intent I would have no problems? Click to expand... YOUR app must read and show the pdf then.
Roberto P. Well-Known Member Licensed User Longtime User Jul 2, 2015 #9 clear. I did not know. thanks I prefer to open the pdf file with Intent because the available objects do not seem very efficient. Upvote 0
clear. I did not know. thanks I prefer to open the pdf file with Intent because the available objects do not seem very efficient.
DonManfred Expert Licensed User Longtime User Jul 2, 2015 #10 Copy the file to external dir before using the intent then Upvote 0
Roberto P. Well-Known Member Licensed User Longtime User Jul 2, 2015 #11 I did just that and it works thanks Upvote 0