How do you turn off share history when using ShareActionProvider?

后端 未结 8 688
遇见更好的自我
遇见更好的自我 2020-12-02 23:31

The new ShareActionProvider available in Android 4.0 (or in earlier versions if you\'re using ActionBarSherlock) has a feature where the last used item is displayed in the a

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 23:38

    Point of clarification: It's not the "last used", it's "most often used", across a sliding window period of time.

    If you prefer not to use history, then before creating your views, call

    yourShareActionProvider.setShareHistoryFileName(null);
    

    Description of this method, from the official docs (emphasis mine):

    Sets the file name of a file for persisting the share history which history will be used for ordering share targets. This file will be used for all view created by onCreateActionView(). Defaults to DEFAULT_SHARE_HISTORY_FILE_NAME. Set to null if share history should not be persisted between sessions.

    EDIT: I should clarify — The "most often used" item won't show up if there's no history, so this is currently the only way of removing that button.

提交回复
热议问题