• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Code won't work, unable to remove recently shared button from actionbar

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a share button on the action bar and although I like the fact it allows me to share to communication components like messaging. I wanted to remove the recently shared button that appears after you've shared to for instance messaging.

I simply can't get the code for this to work.

My code and a link to my project files are below:


Link to project files:

https://www.mediafire.com/?qjysm9suvj1lvjc

**MainActivity


Menu.xml


 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried to set the shared history file to null? Something like:

Your activity implements the OnShareTargetSelectedListener interface. Shouldn't you use it as a listener instead of creating an anonymous inner class.
 
Andrew Tyrer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Irina Goble wrote:Have you tried to set the shared history file to null? Something like:

Your activity implements the OnShareTargetSelectedListener interface. Shouldn't you use it as a listener instead of creating an anonymous inner class.



I tried that, couldn't get it to work...

Have you had any luck??

What changes would you make to the above code?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Andrew Tyrer wrote:

Irina Goble wrote:Have you tried to set the shared history file to null? Something like:



I tried that, couldn't get it to work...


What did you try? What didn't work? What Irina described is what you should be doing. Read the API for ShareActionProvider for a description (see here).
 
Irina Goble
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've never used ShareActionProvider before. The documentation says:

Set to null if share history should not be persisted between sessions.

I tried a simple app to see how it works and turns out there is more to it.
This class, ShareActionProvider, gets quite involved with keeping history of called activities. And there is no simple way to disable the default activity button as it is set not just from a history file but from the history records in the underlying Adapter. Here is a code fragment from the source code that is responsible for this: android.widget.ActivityChooserView.updateAppearance()

 
reply
    Bookmark Topic Watch Topic
  • New Topic