More blocks
More blocks in Sketchware Pro
More Blocks allow developers to create their own blocks useable in a single activity only. They are usually used when there is a task in the app which has to be run multiple times.
Parameters provided by Sketchware pro
- In Variable
- String
- Number
- Boolean
- Map
- List Number
- List String
- List Map
- In View
- View(All types of view available in layout)
- ImageView
- TextView
- CheckBox
- Switch
- ListView
- Spinner Webview
- SeekBar
- ProgressBar
- CalendarView
- RadioButton
- RatingBar
- VideoView
- SearchView
- GridView
- AutoComplete(EditText)
- MultiAutoComplete(EditText)
- ViewPager
- BadgeView
- In Component
- Intent
- SharedPreferences
- Calendar
- Vibrator
- Timer
- Dialog
- MediaPlayer
- SoundPool
- ObjectAnimator
- Firebase DB
- Firebase Auth
- Firebase Storage
- Camera
- FilePicker
- RequestNetwork
- TextToSpeech
- LocationManager
- VideoAd
- ProgressDialog
- TimePickerDialog.
- Notification
More Block types provided by Sketchware provided
- Void(Return nothing)
- String
- Number
- Boolean
- Map
- List String
- List Map
- View
Note: You can't add More Block type rather than above
Get Started
Creating first More Block
Step 1: Open any project in which you want to create More Block.
Step 2: Click on Event.
Step 3: Click on more Block
Step 4: Click on the add icon
Info: For example, I am creating a Block that will display a toast message.
Step 5: Give More Block name as Toast
, choose more Block type as Void(If not selected), and then click on add.
Step 6: Open your created More Block and do as follow.
Step 7: Put this More Block on any part of the activity and then run it.
Info: I am putting this more block on onCreate
, So my toast message will be visible when the app starts.
Step 8: Run the project and install the it.
Info: I placed More Block on onCreate
, So my toast is visible when the app starts.
Frequently asked questions
Can I place More Block inside a More Block?
Yes, you can place More Block inside a more block but placing the same block inside itself will give errors.
Where Sketchware pro will add More Block code?
package....;
import ....;
....
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle _savedInstanceState) {
super.onCreate(_savedInstanceState);
setContentView(R.layout.main);
initialize(_savedInstanceState);
initializeLogic();
}
private void initialize(Bundle _savedInstanceState) {
}
private void initializeLogic() {
_Toast();
}
//More Block code goes here
public void _Toast() {
SketchwareUtil.showMessage(getApplicationContext(), "Type your message here");
}
}