Skip to content

Instantly share code, notes, and snippets.

@andaag
Created January 5, 2015 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andaag/b980b3ca060c269e7d6a to your computer and use it in GitHub Desktop.
Save andaag/b980b3ca060c269e7d6a to your computer and use it in GitHub Desktop.
final Toolbar toolbar = (Toolbar) findViewById(R.id.activity_main_toolbar);
//toolbar.setTitle("This is toolbar title");
toolbar.setTitleTextAppearance(getBaseContext(), R.style.AppTheme_TextStyle);
//toolbar.setSubtitle("This is toolbar Subtitle");
toolbar.setSubtitleTextAppearance(getBaseContext(), R.style.AppTheme_TextStyle);
toolbar.inflateMenu(R.menu.menu_main);
ShareActionProvider bob = (ShareActionProvider) MenuItemCompat.getActionProvider(toolbar.getMenu().findItem(R.id.share_test));
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, "Testing actionbarcompat");
bob.setShareIntent(intent);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment