ShareActionProvider.SetShareHistoryFileName(String) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the file name of a file for persisting the share history which history will be used for ordering share targets.
[Android.Runtime.Register("setShareHistoryFileName", "(Ljava/lang/String;)V", "GetSetShareHistoryFileName_Ljava_lang_String_Handler")]
public virtual void SetShareHistoryFileName (string? shareHistoryFile);
[<Android.Runtime.Register("setShareHistoryFileName", "(Ljava/lang/String;)V", "GetSetShareHistoryFileName_Ljava_lang_String_Handler")>]
abstract member SetShareHistoryFileName : string -> unit
override this.SetShareHistoryFileName : string -> unit
Parameters
- shareHistoryFile
- String
The share history file name.
- Attributes
Remarks
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.
<strong>Note:</strong> The history file name can be set any time, however only the action views created by #onCreateActionView()
after setting the file name will be backed by the provided file. Therefore, if you want to use different history files for sharing specific types of content, every time you change the history file #setShareHistoryFileName(String)
you must call android.app.Activity#invalidateOptionsMenu()
to recreate the action view. You should <strong>not</strong> call android.app.Activity#invalidateOptionsMenu()
from android.app.Activity#onCreateOptionsMenu(Menu)
.
private void doShare(Intent intent) {
if (IMAGE.equals(intent.getMimeType())) {
mShareActionProvider.setHistoryFileName(SHARE_IMAGE_HISTORY_FILE_NAME);
} else if (TEXT.equals(intent.getMimeType())) {
mShareActionProvider.setHistoryFileName(SHARE_TEXT_HISTORY_FILE_NAME);
}
mShareActionProvider.setIntent(intent);
invalidateOptionsMenu();
}
Java documentation for android.widget.ShareActionProvider.setShareHistoryFileName(java.lang.String)
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.