Code example for ShareActionProvider

Methods: setShareIntent

0
 
        private void setShareIntent() { 
        	Intent intent = new Intent(Intent.ACTION_SEND);
        	intent.setType("text/plain");
        	intent.putExtra(Intent.EXTRA_TEXT, "Whether he cares about sports or not, a Bro cares about sports.");
        	mShareActionProvider.setShareIntent(intent);
        } 
        @Override 
        public boolean onOptionsItemSelected(MenuItem item) {
            switch (item.getItemId()) {
                case android.R.id.home:
                    // app icon in action bar clicked; go home 
                    Intent intent = new Intent(this, mainMenuActivity.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(intent);
                    return true; 
                default: 
                    return super.onOptionsItemSelected(item);
            } 
        } 
    public void onCreate(Bundle savedInstanceState) {