← All studio notes

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.

Example import plan
FindingPreviewDecision
New recordsShow items to addImport
Existing recordExplain the conflictSkip or create a separate copy
Malformed rowIdentify the unusable partChoose 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

  1. Select empty, malformed, oversized and unsupported files.
  2. Cancel separately during preview and persistent writing.
  3. Retry the same file after partial processing.
  4. 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.

Sources