Mobile app development / DIJION
Mobile file imports: preview, cancellation and safe retries
A practical import plan separating file selection from completion, with checks for type, size, interruption and duplicate records.
Selecting a file does not mean the app has processed it successfully. Reading can fail, contents may be unsupported and the application can close during processing. In an illustrative notes app, an import should let people understand what will be added and abandon a mistaken selection before existing documents are changed.
Separate selection from validation
The extension, actual contents and parseable structure are separate checks. Explain supported types and the product’s chosen size limit near selection. Do not present an invalid file as a successful empty import. Android’s document picker provides an access mechanism; a returned URI does not by itself promise permanent access or fully local file availability.
Explain the effect before applying changes
Scroll the table horizontally to see all columns.
| Finding | Preview | Decision |
|---|---|---|
| New records | Show items to add | Import |
| Existing record | Explain the conflict | Skip or create a separate copy |
| Malformed row | Identify the unusable part | Choose partial import deliberately |
Do not present partial work as complete
If processing stops after adding some records, define whether retry can create duplicates. Applying changes atomically or in stages depends on data size and the storage model. In either case, distinguish completed, skipped and failed items. An Imported message should describe the actual persistent result, not merely the end of an animation.
Specify when cancellation takes effect
Leaving a preview and stopping after persistent writes begin are different operations. A Cancel button promising immediate reversal needs implementation support. Explain irreversible effects before starting. File names can contain personal information, so avoid automatically attaching full paths or document contents to an error report when a safer diagnostic description will do.
Check representative files and interruptions
- Select empty, malformed, oversized and unsupported files.
- Cancel separately during preview and persistent writing.
- Retry the same file after partial processing.
- Remove file access and inspect the recovery path.
The outcome should account for changed records, not simply the selected file. This makes failure diagnosis and protection of existing user work part of the same import contract.