I'm using UIL to display images in a gridview. When one is selected it displays in a fullscreen window (UIL's ImagePagerActivity class) This screen allows you to flip through the available pictures. I want to use the ShareActionProvider in the action bar to share the currently displayed picture. I keep getting a null pointer exception when loading the onCreateOptionsMenu where it sets the shareIntent. I think it's not finding the displayed picture. Can someone look over this and help?
XML
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/menu_item_share"
android:actionProviderClass="android.suport.v7.widget.ShareActionProvider"
android:showAsAction="ifRoom"
android:title="Share"/>
</menu>
Android
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.album_menu, menu);
MenuItem item = menu.findItem(R.id.menu_item_share);
mShareActionProvider = (ShareActionProvider) item.getActionProvider();
mShareActionProvider.setShareIntent(getDefaultIntent());
return true;
}
private Intent getDefaultIntent() {
Bitmap cachedImage = imageLoader.getMemoryCache().get(imageUrls[pagerPosition]);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/*");
intent.putExtra(Intent.EXTRA_STREAM, cachedImage);
return intent;
}