Created
October 7, 2013 11:05
-
-
Save ianbarber/6866090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onClickShare(View v) { | |
Intent photoPicker = new Intent(Intent.ACTION_PICK); | |
photoPicker.setType("image/*"); | |
startActivityForResult(photoPicker, REQ_SELECT_PHOTO); | |
} | |
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
super.onActivityResult(requestCode, resultCode, data); | |
if(requestCode == REQ_SELECT_PHOTO) { | |
if(resultCode == RESULT_OK) { | |
Uri selectedImage = data.getData(); | |
ContentResolver cr = this.getContentResolver(); | |
String mime = cr.getType(selectedImage); | |
PlusShare.Builder share = new PlusShare.Builder(this); | |
share.setText("hello everyone!"); | |
share.addStream(selectedImage); | |
share.setType(mime); | |
startActivityForResult(share.getIntent(), REQ_START_SHARE); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment