@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate your menu. getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem item = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider provider = (ShareActionProvider) item.getActionProvider(); provider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. provider.setShareIntent(createShareIntent()); return true }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate your menu. getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem item = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider provider = (ShareActionProvider) item.getActionProvider(); provider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. provider.setShareIntent(createShareIntent()); return true }
mShareActionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
public static void configureMenuItem(MenuItem item, Activity callingActivity, Intent intent) { ActionProvider itemProvider = item.getActionProvider(); ShareActionProvider provider = null; if (!(itemProvider instanceof ShareActionProvider)) { provider = new ShareActionProvider(callingActivity); } else { provider = (ShareActionProvider) itemProvider; } provider.setShareHistoryFileName(HISTORY_FILENAME_PREFIX + callingActivity.getClass().getName()); provider.setShareIntent(intent); item.setActionProvider(provider); } }
public static void configureMenuItem(MenuItem item, Activity callingActivity, Intent intent) { ActionProvider itemProvider = item.getActionProvider(); ShareActionProvider provider = null; if (!(itemProvider instanceof ShareActionProvider)) { provider = new ShareActionProvider(callingActivity); } else { provider = (ShareActionProvider) itemProvider; } provider.setShareHistoryFileName(HISTORY_FILENAME_PREFIX + callingActivity.getClass().getName()); provider.setShareIntent(intent); item.setActionProvider(provider); } }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.content_actions, menu); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(this); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("image/*"); Uri uri = Uri.fromFile(getFileStreamPath("shared.png")); shareIntent.putExtra(Intent.EXTRA_STREAM, uri); actionProvider.setShareIntent(shareIntent); return true; }
getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); ***actionProvider.setShareHistoryFileName(null); OnShareTargetSelectedListener listener = new OnShareTargetSelectedListener() { public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) { startActivity(intent); return true; } }; actionProvider.setOnShareTargetSelectedListener(listener);***
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.mymenu, menu); MenuItem actionItem = menu.findItem(R.id.mymenu_item); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); actionProvider.setOnShareTargetSelectedListener(new ShareActionProvider.OnShareTargetSelectedListener() { public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) { doSomeStuff();//TODO return false; }} ); actionProvider.setShareIntent(createShareIntent()); MenuItem overflowItem = menu.findItem(R.id.mymenu_item); ShareActionProvider overflowProvider = (ShareActionProvider) overflowItem.getActionProvider(); overflowProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); overflowProvider.onPerformDefaultAction(); overflowProvider.setShareIntent(createShareIntent()); return super.onCreateOptionsMenu(menu); }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate your menu. getMenuInflater().inflate(R.menu.action_bar_share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. actionProvider.setShareIntent(createShareIntent()); // Set file with share history to the provider and set the share intent. MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow); ShareActionProvider overflowProvider = (ShareActionProvider) overflowItem.getActionProvider(); overflowProvider.setShareHistoryFileName( ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. overflowProvider.setShareIntent(createShareIntent()); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate your menu. getMenuInflater().inflate(R.menu.action_bar_share_action_provider, menu); // Set file with share history to the provider and set the share intent. MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar); ShareActionProvider actionProvider = (ShareActionProvider) actionItem.getActionProvider(); actionProvider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. actionProvider.setShareIntent(createShareIntent()); // Set file with share history to the provider and set the share intent. MenuItem overflowItem = menu.findItem(R.id.menu_item_share_action_provider_overflow); ShareActionProvider overflowProvider = (ShareActionProvider) overflowItem.getActionProvider(); overflowProvider.setShareHistoryFileName( ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // Note that you can set/change the intent any time, // say when the user has selected an image. overflowProvider.setShareIntent(createShareIntent()); return true; }
.getActionProvider(); actionProvider .setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME); // this