Android app pause and resume

31 views
Skip to first unread message

Degenerate Tech

unread,
Nov 14, 2020, 3:04:51 AM11/14/20
to Kivy users support
I have made a simple paint app for Android ..after resume my paint app all drawing being lost....I want to save drawing instructions in a file during pause and I want to draw previous drawing during resume mode..how to do that ?

planckp...@gmail.com

unread,
Nov 14, 2020, 2:38:31 PM11/14/20
to Kivy users support
Two separate things.

1) You can save stuff on_pause() [ see any Python tutorial for writing files], but you don't need to.
p4a will automatically save/resume any class variable (self.whatever) state.

2) Either
a) Save the information used to create the drawing instruction in a class variable. So for example when you define a new_line used by a Line() canvas instruction add it to a save list self.lines.append(new_line). Then create the canvas instruction from the saved data. Obviously there is other data to save, you are probably going to create a list of dict.

b) Consider using InstructionGroup to create a set of instruction and gave the group in  class variable.
I don't have an example.
Reply all
Reply to author
Forward
0 new messages