Advertisement
Guest User

andprob

a guest
Sep 19th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. @Override
  2. public boolean onCreateOptionsMenu(Menu menu) {
  3. // TODO Auto-generated method stub
  4. MenuInflater inflater = getMenuInflater();
  5. inflater.inflate(R.menu.feed, menu);
  6. return true;
  7. }
  8.  
  9. @Override
  10. public boolean onOptionsItemSelected(MenuItem item) {
  11. // TODO Auto-generated method stub
  12. switch (item.getItemId()) {
  13. case R.id.action_profile:
  14. {
  15. Toast.makeText(this, "Showing Profile", Toast.LENGTH_SHORT).show();
  16. Intent intentProfile = new Intent(FeedActivity.this, ProfileActivity.class);
  17. startActivity(intentProfile);
  18. break;
  19. }
  20. case R.id.action_record:
  21. {
  22. Toast.makeText(this, "Showing Record", Toast.LENGTH_SHORT).show();
  23. Intent intentRecord = new Intent(FeedActivity.this, RecordActivity.class);
  24. startActivity(intentRecord);
  25. break;
  26. }
  27.  
  28. default:
  29. {
  30. break;
  31. }
  32. }
  33.  
  34. return true;
  35. }
  36.  
  37.  
  38. <?xml version="1.0" encoding="utf-8"?>
  39. <menu xmlns:android="http://schemas.android.com/apk/res/android" >
  40.  
  41. <item
  42. android:id="@+id/action_record"
  43. android:icon="@drawable/microphone67"
  44. android:showAsAction="always"
  45. android:title="Record new voice"
  46. android:orderInCategory="1"/>
  47.  
  48. <item
  49. android:id="@+id/action_profile"
  50. android:icon="@drawable/profile_button"
  51. android:showAsAction="always"
  52. android:title="User Profile"
  53. android:orderInCategory="2"/>
  54.  
  55. </menu>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement