Ejemplo n.º 1
0
  @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 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());

    // XXX: For now, ShareActionProviders must be displayed on the action bar
    // 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;
  }
 public boolean onMenuItemClick(MenuItem menuitem)
 {
     menuitem = ActivityChooserModel.get(ShareActionProvider.access$0(ShareActionProvider.this), ShareActionProvider.access$1(ShareActionProvider.this)).chooseActivity(menuitem.getItemId());
     if (menuitem != null)
     {
         ShareActionProvider.access$0(ShareActionProvider.this).startActivity(menuitem);
     }
     return true;
 }
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getSupportMenuInflater();
    inflater.inflate(R.menu.showinfo_menu, menu);

    MenuItem shareItem = menu.findItem(R.id.menu_share);
    ShareActionProvider shareActionProvider = (ShareActionProvider) shareItem.getActionProvider();
    shareActionProvider.setShareIntent(mShareIntentBuilder.getIntent());

    return true;
  }
 private void updateShareIntent() {
   // update share intent
   final IntentBuilder builder = IntentBuilder.from(activity);
   builder.setText(determineBitcoinRequestStr(false));
   builder.setType("text/plain");
   builder.setChooserTitle(R.string.request_coins_share_dialog_title);
   shareActionProvider.setShareIntent(builder.getIntent());
 }
Ejemplo n.º 5
0
  @Override
  public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
    getSupportMenuInflater().inflate(R.menu.items, menu);

    mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.share).getActionProvider();
    Intent intent = getDefaultShareIntent();

    /** Setting a share intent */
    if (intent != null) mShareActionProvider.setShareIntent(intent);
    return super.onCreateOptionsMenu(menu);
  }