Note that there are some explanatory texts on larger screens.

plurals
  1. POhow do i get my ShareActionProvider to submit text Dynamically (from listeners) view pagers etc
    primarykey
    data
    text
    <p>I am using Sherlock Library Action Bar, which is similar to the ICS action bars, the place where I am stuck is this</p> <pre><code> @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add("Save") .setIcon(R.drawable.ic_compose).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add("Search") .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); SubMenu sub = menu.addSubMenu("Options"); sub.add(0, SubMenu.NONE, 0, "First"); sub.add(0,SubMenu.NONE, 1, "Second"); sub.add(0, SubMenu.NONE, 2, "Three"); sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT); // HERE IS WHere I AM FACING PROBLEM IN getSupportMenuInflater().inflate(R.menu.share_action_provider, menu); // Set file with share history to the provider and set the share intent. 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); //this is BRILLIANT WAY TO AVOID REPEATation actionProvider.setShareIntent(createShareIntent()); return super.onCreateOptionsMenu(menu); } private Intent createShareIntent() { Intent shareIntent = new Intent(Intent.ACTION_SEND); shareIntent.setType("text/plain"); //THIS TEXT IS WHAT I WANT TO OBTAIN DYNAMICALLY shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Something goes here"); return shareIntent; } </code></pre> <p>Whenever I try putting the <code>actionProvider.setShareIntent(createShareIntent());</code> inside a listener or anywhere other than the <code>actionProvider.setShareIntent(createShareIntent());</code> I get <code>D/View(11753): onTouchEvent: viewFlags is DISABLED</code></p> <p>I wish to include this sharing Action provider and want to input my own text that gets generated on user inputs.</p> <p>Any inputs are welcome.</p> <p>Adding this doesn't work </p> <pre><code> actionItem.setOnMenuItemClickListener(new OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { Log.e("THIS IS NEVER CALLED", "??"); return true; } }); </code></pre> <p>How do I get an update for the Share button being clicked</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload