File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Andrew Tyrer
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • 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


 
Irina Goble
Ranch Hand
Posts: 91
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
Steve Luke
Bartender
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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()

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic