EyeQ Tech
EyeQ Tech

Reputation: 7358

Android, sharing goes straight to Gmail, skip other apps

I implement a sharing menu item and start the Chooser intent manually (instead of using ShareActionProvider).

My code:

case R.id.share_a_query:
    {

        if (BuildConfig.DEBUG)
            Log.i("Share menu click", "Tung");

        try{
            Intent intentPartager = new Intent(Intent.ACTION_SEND);
            intentPartager.setType("text/*");
            intentPartager.putExtra(Intent.EXTRA_TEXT, "plain text text")         ;
            Intent startingIntent = Intent.createChooser(intentPartager, "Share this using...");
            startActivity(startingIntent);
        }
        catch(Exception e){
            e.printStackTrace();
            //Toast.makeText(this, R.string.erreurFaceBookAbsent, Toast.LENGTH_SHORT).show();
        }

        return true;
    }

If I set the type as text/plain or text/*, the app doesn't show the chooser at all, but instead jump directly to Gmail. If I change that to image/* then a list of apps is shown. Am I missing anything here? Tks

Upvotes: 1

Views: 632

Answers (1)

Related Questions