How do you turn off share history when using ShareActionProvider?

后端 未结 8 661
遇见更好的自我
遇见更好的自我 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:53

    add the code like this:

        private void addShareSelectedListener() {
        if (null == mShareActionProvider) return;
        OnShareTargetSelectedListener listener = new OnShareTargetSelectedListener() {
            public boolean onShareTargetSelected(ShareActionProvider source, Intent intent) {
                mContex.startActivity(intent);
                return true;
            }
        };
    
    //Set to null if share history should not be persisted between sessions.
        mShareActionProvider.setShareHistoryFileName(null);
        mShareActionProvider.setOnShareTargetSelectedListener(listener);
    
    }
    

提交回复
热议问题