B4A Code Snippet Get the path to media files returned from ContentChooser - Erel    Jul 24, 2022   (8 reactions) It is a mistake to try to get a file path from the returned resource. It will not work in most cases, and even if you will be able to get the path, you will not be able to access it.
You can use File.OpenInput to access the remote resource.
Correct solution: TextEditor - Save and load external fi B4A Tutorial select image from device and upload in server - Erel (first post)    Jun 30, 2024   (1 reaction) GetPathFromContentResult = broken code. Don't use it.
The user can choose a resource that is not stored on the device or that isn't stored as a file. B4A Question CursorIndex Out Of Bounds Exception - Erel (first post)    Jan 03, 2017   (1 reaction) GetPathFromContentResult is problematic and is not guaranteed to work.
You don't need to use it if you want to read data from the resource. You can open an InputStream with the parameters passed in the Result sub.
You will not be able to use it with AsyncStreams.WriteStream but you will be able to B4A Question media player strange behavior on Xiaomi phone - Erel (first post)    Aug 08, 2021   (1 reaction) There are many mistakes in this code. For example any code that calls GetPathFromContentResult = broken code.
See the new TextEditor example: TextEditor - Save and load external files
With that said, you cannot assume that the URI will be kept accessible. B4A Question open failed: EACCES (Permission denied) - Erel (first post)    Jun 13, 2018   (2 reactions) To avoid confusion to other developers I must say that almost everything that is written in this thread is incorrect.
No permission is required to access photos selected with ContentChooser. The main mistake is the usage of GetPathFromContentResult.
Search: https://www.b4x.com/search?query=GetPath B4A Question Get the path of multiple images from the gallery - Esteve    Aug 23, 2016 https://dl.dropboxusercontent.com/u/103664200/Images/Cap1.PNG I think that they might be obtained with GetPathFromContentResult but I don't know how do it. Thanks. B4A Code Snippet Choose audio file and play with MediaPlayer - Erel (first post)    Nov 10, 2019   (2 reactions) As you are you using GetPathFromContentResult it is worth adding the bold warning:
In most cases it is a mistake to use this sub. Especially in newer versions of Android. You shouldn't assume that the resource returned from ContentChooser comes from the file system and if it is, you most probably w B4A Question Object should first be initialized (Cursor). with GetPathFromContentResult() - Didier9 (first post)    Jan 25, 2018 The point is that Erel's GetPathFromContentResult() demo works (solidly) with the files I am trying it with but my code which incorporates it does not work with the SAME files (at least it works erratically).
Note: I renamed the thread to more accurately reflect that the problem is not with Content B4A Question Custom ringtone not work - Erel (first post)    Dec 05, 2018 This code cannot work:
strPath=GetPathFromContentResult(File.Combine(File.DirInternal,"rington.mp3"))
Try to add the ringtone with RingtoneManager.AddToMediaStore and then use the returned URI (I haven't tried it myself). B4A Question WhatsApp Uri how to get the image - Erel (first post)    Oct 19, 2020 Code based on GetPathFromContentResult = broken code.
Do you want to load the image?
Dim bmp As B4XBitmap = XUI.LoadBitmap("ContentDir", Uri) Page: 1   2   3   4   5   6   7   Powered by ColBERT |