HomeSketchwareAdd menu in actionbar in Sketchware

Add menu 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:-
}

@Override
public boolean onCreateOptionsMenu (Menu menu){
menu.add(0,0,0,”Settings”);
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:-

}
@Override
public 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 4 cases.

7) Then add 4 more blocks. In here I am created settings, profile, about, rate .

That,s all. Save and run project…


Leave a Reply