Android ShareActionProvider - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ShareActionProvider class.

This code example shows how to use the following methods:setShareIntent
 
	public void doShare() { 
		Intent intent = new Intent(Intent.ACTION_SEND);
		intent.setType("text/plain");
		intent.putExtra(Intent.EXTRA_TEXT, "Message");
		provider.setShareIntent(intent);
	} 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareHistoryFileName, setShareIntent
	@Override 
	public void initMenu(Menu menu) {
		itemShare = menu.add(0, 1, 150, "Share");
		itemShare.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
		itemShare.setIcon(android.R.drawable.ic_menu_share);
		ShareActionProvider actionProvider = new ShareActionProvider(this);
		itemShare.setActionProvider(actionProvider);
		actionProvider
				.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
		actionProvider.setShareIntent(createShareIntent());
	} 
 
	private Intent createShareIntent() {
		Intent shareIntent = new Intent(Intent.ACTION_SEND);
		shareIntent.setType("text/*");
		shareIntent.putExtra(Intent.EXTRA_TEXT, "share body");
		shareIntent.putExtra(Intent.EXTRA_SUBJECT, "share title");
		return shareIntent;
	} 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareHistoryFileName, setShareIntent
		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");  
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareIntent
 
        private void setShareIntent() { 
        	Intent intent = new Intent(Intent.ACTION_SEND);
        	intent.setType("text/plain");
        	intent.putExtra(Intent.EXTRA_TEXT, "A Bro respects all his Bros in the military because they�ve selflessly chose to defend the nation, but more to the point, because they can kick his ass six ways to Sunday.");
        	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);
            } 
        } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareIntent
 
        private void setShareIntent() { 
        	Intent intent = new Intent(Intent.ACTION_SEND);
        	intent.setType("text/plain");
        	intent.putExtra(Intent.EXTRA_TEXT, "When wearing a baseball cap, a Bro may position the brim at either 12 or 6 o� clock. All other angles are reserved for rappers and the handicapped.");
        	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);
            } 
        } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareHistoryFileName, setShareIntent
 
        actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
 
        actionItem.setIcon(android.R.drawable.ic_menu_share);
 
        ShareActionProvider provider = new ShareActionProvider(this);
        provider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
        provider.setShareIntent(createShareIntent());
        actionItem.setActionProvider(provider);
 
 
        return true; 
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item){
        if(item.getTitle()=="Config"){
 
        } 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareIntent
 
        private void setShareIntent() { 
        	Intent intent = new Intent(Intent.ACTION_SEND);
        	intent.setType("text/plain");
        	intent.putExtra(Intent.EXTRA_TEXT, "A Bro should be able, at any time, to recite the following reigning champions: Super Bowl, World Series and Playmate of the Year.");
        	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);
            } 
        } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareHistoryFileName, setShareIntent
 
        actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
 
        actionItem.setIcon(android.R.drawable.ic_menu_share);
 
        ShareActionProvider provider = new ShareActionProvider(this);
        provider.setShareHistoryFileName(ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
        provider.setShareIntent(createShareIntent());
        actionItem.setActionProvider(provider);
 
 
        return true; 
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item){
        if(item.getTitle()=="Config"){
 
        } 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareIntent
 
        private void setShareIntent() { 
        	Intent intent = new Intent(Intent.ACTION_SEND);
        	intent.setType("text/plain");
        	intent.putExtra(Intent.EXTRA_TEXT, "A Bro doesn't let another Bro get a tattoo, particularly a tattoo of a girl's name.");
        	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);
            } 
        } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setShareIntent
 
        private void setShareIntent() { 
        	Intent intent = new Intent(Intent.ACTION_SEND);
        	intent.setType("text/plain");
        	intent.putExtra(Intent.EXTRA_TEXT, "Bros do not share dessert.");
        	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);
            } 
        } 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java

Related Android ShareActionProvider Questions & Answers:

See Code Examples for Android ShareActionProvider Methods: