Pre-populating a naturalForms document from another app on Android devices:
- From the originating app, create a CSV file using a file output stream
- Open the file using a view action intent of type “text/csv”
Note: Since the NaturalForms app declares that it can perform the action requested by the intent, the android device lists it as an option to handle the action.
The intent should be used in the code when the CSV is created to coincide with the intents that naturalForms is registered for. This would remove the dependency on the device's native file manager, which can now be problematic depending on the device manufacturer.
Here is some UNRELATED code that is an example of opening folder with:
String folderPath = Environment.getExternalStorageDirectory()+"/pathTo/folder";
Intent intent = new Intent();
intent.setAction(Intent.ACTION_GET_CONTENT);
Uri myUri = URI.parse(folderPath);
intent.setDataAndType(myUri , "file/*");
startActivity(intent);
Comments