According to the Android documentation, if I do not want my ShareActionProvider to save the sharing history, I have to call
mShareActionProvider.setShareHistoryFileName(null)
However, when I do this, I get the following crash when choosing the sharing option:
11-15 10:06:34.848: E/AndroidRuntime(22461): java.lang.IllegalStateException: No preceding call to
Here is the code that sets ShareActionProvider:
public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.article_pager_menu, menu); // mShareActionProvider is a field in the Activity mShareActionProvider = (ShareActionProvider) menu.findItem(R.id.menu_share) .getActionProvider(); mShareActionProvider .setShareHistoryFileName(null); Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); mShareActionProvider.setShareIntent(shareIntent); mShareActionProvider.onCreateActionView(); return true; }
Any ideas how I can fix this?
android android-intent android-actionbar shareactionprovider
steemcb
source share