How to show one time message/dialog in sketchware
One time message or one time dialog is a simple task for sketchware that every new coder find difficult to implement in sketchware. This task can easily be done by use of shared preferences and it do not require any external codes or blocks.
What is shared preferences
It is a component of sketchware that is used to store strings database in app data. The files made by shared preferences is not stored locally in internal storage of device. Shared preferences can store any type of strings and that is what we are going to use in sketchware today.
Making one time appear dialog
Follow these steps to make one time appear dialog in sketchware.
- Go to your project
- Go to component manager
- Click on + icon and choose shared preferences
- name it "sp"
- When user click on any button or something put data key show to no
- In oncreate, add an if-then-else condition and check if sp get key show equals blank then show dialog else don't show dialog.
You can name anything to these variables but don't try to access invalid file ( for example if you set the file as show and if you try to access it with another name then it will lead your app to crash.)
Comments