Image share intent works for Gmail but crashes FB and twitter

Twitter (wrongly) assumes that there will be a MediaStore.MediaColumns.DATA column. Starting in KitKat the MediaStore returns null, so luckily, Twitter gracefully handles nulls, and does the right thing. public class FileProvider extends android.support.v4.content.FileProvider { @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor source = super.query(uri, projection, selection, selectionArgs, … Read more

How to Share Image + Text together using ACTION_SEND in android?

You can share plain text with the following code String shareBody = “Here is the share content body”; Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); sharingIntent.setType(“text/plain”); sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, “Subject Here”); sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody); startActivity(Intent.createChooser(sharingIntent, getResources().getString(R.string.share_using))); So your full code (your image + text) becomes private Uri imageUri; private Intent intent; imageUri = Uri.parse(“android.resource://” + getPackageName() + “/drawable/” + “ic_launcher”); … Read more

Share Text on Facebook from Android App via ACTION_SEND

To make the Share work with the facebook app, you only need to have suply at least one link: Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(“text/plain”); intent.putExtra(Intent.EXTRA_TEXT, “Wonderful search engine http://www.google.fr/”); startActivity(Intent.createChooser(intent, “Share with”)); This will show the correct sharing window but when you click on share, nothing happends (I also tried with the official Twitter … Read more

How to filter specific apps for ACTION_SEND intent (and set a different text for each app)

To my knowledge, StackOverflow has lots of people asking this question in various ways, but nobody has answered it completely yet. My spec called for the user to be able to choose email, twitter, facebook, or SMS, with custom text for each one. Here is how I accomplished that: public void onShareClick(View v) { Resources … Read more