java - How do you write an extra class for often used code and call it from everywhere? -
in little app users can have @ 'more information' or send me feedback when click on the menu button (of device) @ every xml file of app. this code (when click on menu button): @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.menu, menu); return super.oncreateoptionsmenu(menu); } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.impressum: startactivity(new intent (this, moreinformation.class)); break; case r.id.feedback: /* * */ break; } return super.onoptionsitemselected(item); } now put code java classes. works i'd create class (let's call ismenubuttonpressed.class ) contains code above , i'd remove code above other java classes , call ismenubuttonpressed.class (in these java classes when menu button pressed). how can that? how pass informati...