Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // TODO Auto-generated method stub
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.feed, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // TODO Auto-generated method stub
- switch (item.getItemId()) {
- case R.id.action_profile:
- {
- Toast.makeText(this, "Showing Profile", Toast.LENGTH_SHORT).show();
- Intent intentProfile = new Intent(FeedActivity.this, ProfileActivity.class);
- startActivity(intentProfile);
- break;
- }
- case R.id.action_record:
- {
- Toast.makeText(this, "Showing Record", Toast.LENGTH_SHORT).show();
- Intent intentRecord = new Intent(FeedActivity.this, RecordActivity.class);
- startActivity(intentRecord);
- break;
- }
- default:
- {
- break;
- }
- }
- return true;
- }
- <?xml version="1.0" encoding="utf-8"?>
- <menu xmlns:android="http://schemas.android.com/apk/res/android" >
- <item
- android:id="@+id/action_record"
- android:icon="@drawable/microphone67"
- android:showAsAction="always"
- android:title="Record new voice"
- android:orderInCategory="1"/>
- <item
- android:id="@+id/action_profile"
- android:icon="@drawable/profile_button"
- android:showAsAction="always"
- android:title="User Profile"
- android:orderInCategory="2"/>
- </menu>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement