HomeArchive by Category "Sketchware"
Posted in Sketchware

Toast a message with a custom view in sketchware

1) Create a new Sketchware Project. 2) Add a new Custom view with name custom. 3) Add a more block customToast with a String text. 4) In that Moreblock add a ASD block and copy the below code:-LayoutInflater inflater = getLayoutInflater();View toastLayout = inflater.inflate(R.layout.custom, null);TextView textview = (TextView) toastLayout.findViewById(R.id.textview1);textview.setText(_text);LinearLayout linear = (LinearLayout) toastLayout.findViewById(R.id.linear1);Toast toast = […]

Posted in Sketchware

Menu with icon in actionbar in sketchware

1) Create a sketchware project.2) Add a more block extra. 3) In that more block extra do as below:- 4) Code used in First ASD block is:-}@Overridepublic boolean onCreateOptionsMenu (Menu menu){menu.add(0,0,0,”Settings”).setIcon(R.drawable.settings) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);menu.add(0,1,1,”Profile”);menu.add(0,2,2,”About”);menu.add(0,3,3,”Rate now”);return true;5) Code used in Second ASD block is:-}@Overridepublic boolean onOptionsItemSelected(MenuItem item){switch (item.getItemId()){case 0:_settings();break;case 1:_profile();break;case 2:_about();break;case 3: _rate();break;}return super.onOptionsItemSelected(item);6) Since I added 4 menus there is only […]