If I want to access an image or file that is contained in the system.ResourceDirectory is where themain.lua file is, from native android code, how do I do it?
For instance “file://imagename.png”? I just need the appropriate path as I am passing it to another Intent as an argument.
If this intent is being sent to one of your own activities, then you can easily open an input stream to your file via Corona’s “FileServices” class. This class provides access to files in the ResourceDirectory and DocumentsDirectory. Files under what Corona calls the ResourceDirectory are referred to as “asset” files on Android because they’re typically within the APK’s “assets” directory… or the Google Play expansion file if you’re using it. http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/storage/FileServices.html
If you are sending an intent to another app, then you’ll run into a different problem. External apps do not have direct access to your app’s files. In this case, you’ll need to use Corona’s “FileContentProvider” class which provides read-only access to your app’s files. The way this works is that you create a URI that references your file by calling FileContentProvider.createContentUriForFile(…). When you pass this URI to an external app, it then access Corona’s FileContentProvider to get a hold of the file’s input stream and access its bytes. This works for both internal resource/asset files and external files in the documents directory. http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/storage/FileContentProvider.html
If this intent is being sent to one of your own activities, then you can easily open an input stream to your file via Corona’s “FileServices” class. This class provides access to files in the ResourceDirectory and DocumentsDirectory. Files under what Corona calls the ResourceDirectory are referred to as “asset” files on Android because they’re typically within the APK’s “assets” directory… or the Google Play expansion file if you’re using it. http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/storage/FileServices.html
If you are sending an intent to another app, then you’ll run into a different problem. External apps do not have direct access to your app’s files. In this case, you’ll need to use Corona’s “FileContentProvider” class which provides read-only access to your app’s files. The way this works is that you create a URI that references your file by calling FileContentProvider.createContentUriForFile(…). When you pass this URI to an external app, it then access Corona’s FileContentProvider to get a hold of the file’s input stream and access its bytes. This works for both internal resource/asset files and external files in the documents directory. http://docs.coronalabs.com/daily/native/android/html/com/ansca/corona/storage/FileContentProvider.html