Code example for ShareActionProvider

Methods: setShareHistoryFileName, setShareIntent

1
		MenuItem item1=menu.add("show");
	    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	    item.setIcon(android.R.drawable.ic_menu_today);
	    item1.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	    item1.setIcon(android.R.drawable.alert_light_frame);
	    provider = new ShareActionProvider(this);
	    item.setActionProvider(provider);
	    provider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);	
	    provider.setShareIntent(shareIntent);
	     
//	    Intent shareIntent = new Intent(Intent.ACTION_SEND); 
//	    shareIntent.setType("image/*"); 
//	    Uri uri = Uri.fromFile(new File(getFilesDir(), "foo.jpg")); 
//	    shareIntent.putExtra(Intent.EXTRA_STREAM, uri.toString());	     
//	    item1.setIcon(android.R.drawable.ic_menu_today);     
//		getMenuInflater().inflate(R.menu.activity_main, menu); 
//		super.onCreateOptionsMenu(menu);  
//        MenuItem add = menu.add(0, 1, 0, "Save");  
//        MenuItem open = menu.add(0, 2, 1, "Open");  
//        MenuItem close = menu.add(0, 3, 2, "Close");  
//        add.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);