Database access from Rust #5
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
It is possible to obtain a path which Rust can directly use to create and manage files, such as SQLite database files, with
Context.getDatabasePath(file name)
.A
MainActivity
has a context, so it's possible to callgetDatabasePath
directly. From within aComposable
, it is possible to access the context viaLocalContext.current
, although this shouldn't be necessary.The
sqlite
Rust crate seems run fine on Android.It is probably not worth to worry about the fact access to the database would be blocking at first. If it becomes a concern,
tokio::task::spawn_blocking
can probably be used to help alleviate the problem.