title: share Fb,Tw and Email using Intent.action_SEND in android
body: <p>I have to post the text and email to FB,TW and Email.</p>
  
  <p>Here i have created one imageview.if i have to clcik these imageview means the alert dislog box is opening.Here the following 3 item is listed: FB,TW,Email </p>
  
  <p>Here if i have to FB on alert list which means it is go to FB app using action_send...also post the text and image.The other TW and Email app is hide.</p>
  
  <p>If i ahve to click on TW on alert list means it is go to Tw app and post the text and image at the same time hide the FB,Email app...</p>
  
  <p>How can i do ???</p>
  
  <p>pls help me ..i have used below code...here i ahve to clicked Fb means nothing is happened ??? pls give me solution for these...my device installed FB,TW app also...then why nothing is happening ??? pls give me suggestion ??? what's wrong in my code ???</p>
  
  <pre><code>ImageView share = (ImageView) findViewById(R.id.imageView5);
      share.setOnClickListener(new OnClickListener()
      {
          public void onClick (  final View v )
          {
              final CharSequence[] items =
              {
                      "Facebook", "Twitter", "Email"
              };
  
              AlertDialog.Builder builder = new AlertDialog.Builder(SubCate.this);
              builder.setTitle("Share Via:");
              builder.setItems(items, new DialogInterface.OnClickListener()
              {
                  public void onClick ( DialogInterface dialog , int item )
                  {
                      if (items[item] == "Facebook")
                      {
  
                          initShareIntent("facebook");
  
                      }
                      if(items[item] == "Twitter"){
                          initShareIntent("twitter");
  
                         } 
                      if (items[item] == "Email")
                      {
  
                          initShareIntent("gmail");
  
                      }
                  }
              });
              AlertDialog alert = builder.create();
              alert.show();
          }
      });
  }
  
  
  
    private void initShareIntent(String type) {
          boolean found = false;
          Intent share = new Intent(android.content.Intent.ACTION_SEND);
          share.setType("image/jpeg");
  
          // gets the list of intents that can be loaded.
          List&lt;ResolveInfo&gt; resInfo = getPackageManager().queryIntentActivities(share, 0);
          if (!resInfo.isEmpty()){
              for (ResolveInfo info : resInfo) {
                  if (info.activityInfo.packageName.toLowerCase().contains(type) || 
                          info.activityInfo.name.toLowerCase().contains(type) ) {
                      share.putExtra(Intent.EXTRA_SUBJECT,  _Substring);
                      share.putExtra(Intent.EXTRA_TEXT,     _Substring);
                      share.putExtra(Intent.EXTRA_STREAM, Uri.parse(_Image)); 
                      share.setPackage(info.activityInfo.packageName);
                      found = true;
                      break;
                  }
              }
              if (!found)
                  return;
  
              startActivity(Intent.createChooser(share, "Select"));
          }
      }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here i have to run the app:</p>
  
  <p>If i have to click Fb means facebook wall is opening...But the text is not displaying here...</p>
  
  <p>If i ahev to click Tw means twitter wall is opening...Twitter text is displayed on wall..But image is couldnot loaded message is displayed ....</p>
  
  <p>If i have to click email means gmail is opening and also displayed the text on subject well...</p>
  
  <p>Why twiiter image couldn't loaded message is displaying...also FB text and image is not displaying ???? pls give me solution for these ????</p>