CodeName OneShai Almog7 min readintermediate
Native Drag and Drop Meets Cross-Device Continuity
Summary
Codename One 8.0 adds two user‑experience primitives: **Cross‑Device Continuity** (state checkpointing + Apple Handoff + custom HTTP relay) and **Native Drag‑and‑Drop** (OS‑level drag using the same ClipboardContent model). The post shows the API (StateProvider, Continuity.checkpoint, NativeDragOperation), platform support tables, and practical advice on payload size, security, thread handling, a…
- Continuity: implement StateProvider to serialize minimal app state (e.g., draft text) and call Continuity.checkpoint() after edits; restore with Continuity.restore() after auth; can use Apple Handoff, iCloud KV, or a cu…
- Native drag‑and‑drop: create a NativeDragOperation (e.g., file list) and set a drop target with accepted MIME types; data can be supplied lazily via ClipboardContent.setDataProvider, but providers may run at drag start…
- Threading: native drop callbacks run on the platform drag thread; Codename One marshals to the EDT; avoid blocking the drag thread.
- Lifecycle: disable auto‑restore if you need user confirmation, clear state on logout, and set max age to avoid stale checkpoints.
These APIs let developers preserve user work across devices and let users move data between apps without copy‑paste, reducing friction in mobile‑first workflows. The design balances privacy (small, non‑credential payloads) with flexibility (custom relay), and the drag‑and‑drop implementation reuses…
6/10