In R.string.share_content
, I am having content more or less like
free download from http://www....
Instead of completely URL, I would like to have short URL (lie bit.ly/AbC) as normally use in Twitter sharing? How is it possible for my app to insert short URL if the share is done through twitter?
private void share() {
final String share_subject = getString(R.string.share_subject);
final String share_content = getString(R.string.share_content);
final String share_intent_title = getString(R.string.share_intent_title);
File file = mainView.getScreenshotFile();
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_SUBJECT, share_subject);
intent.putExtra(Intent.EXTRA_TEXT, share_content);
// http://stackoverflow.com/questions/5214764/how-to-share-photo-with-caption-via-android-share-intent-on-facebook
intent.putExtra(Intent.EXTRA_TITLE, share_content);
// http://stackoverflow.com/questions/9023116/sharing-an-image-with-google-app-using-intent-action-send-and-intent-extra-stre
ContentValues values = new ContentValues(2);
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
values.put(MediaStore.Images.Media.DATA, file.getAbsolutePath());
Uri uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
intent.putExtra(Intent.EXTRA_STREAM, uri);
//intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(Intent.createChooser(intent, share_intent_title));
}