0

我必須發佈文本和電子郵件到FB,TW和電子郵件。分享Fb,Tw和電子郵件使用Intent.action_SEND在android

在這裏,我已經創建了一個imageview.if我不得不clcik這些imageview的手段警告dislog框opening.Here以下3項所列:FB,TW,電子郵件

這裏,如果我要在FB警報列表,這意味着它是去FB應用程序使用action_send ...也張貼的文字和圖像。其他TW和電子郵件應用程序隱藏。

如果我ahve點擊TW提示列表意味着它是去Tw到應用程序,並張貼在同一時間隱藏FB,電子郵件應用程序中的文本和圖像...

我該怎麼辦? ?

請幫我..我已經使用下面的代碼...在這裏,我要點擊FB意味着什麼都沒有發生?請給我解決這些......我的設備安裝了FB,TW應用程序也......那麼爲什麼什麼都沒有發生?請給我建議?我的代碼有什麼問題?

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<ResolveInfo> 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")); 
     } 
    } 

編輯:

這裏,我已經運行應用程序:

如果我必須點擊Fb的手段Facebook塗鴉牆被打開......但文本不在這裏顯示..

如果我ahev點擊Tw意味着twitter牆正在打開... Twitter文本顯示在牆上..但圖像是不能加載的消息顯示....

如果我必須點擊電子郵件意味着gmail正在打開,並且還顯示主題上的文字以及...

爲什麼圖像無法加載消息正在顯示...也FB文本和圖像不顯示?? ??請給我解決這些?

回答

0

使用SoicalAuth此功能它很容易,你不需要創建該ListView和佈局.... 看到this link

+0

是的,我已經這樣做過了..我希望通過action_send ly.thats發展,我已經發布了 – user2218667 2013-04-22 07:26:38

+0

好的。我有一個建議,如果你有列表發佈fb,twitter等,那麼爲什麼你需要按鈕,然後點擊event.your希望開發這種方式確定。 – 2013-04-22 08:18:33

0

在Facebook中的已知問題,通過動作發送用戶無法加載文本,但你可以上傳圖片。也可以使用Facebook API加載文本。

在Twitter中,您還可以發送圖像以及文字,它不會顯示任何問題。

請嘗試下面的代碼。希望這會幫助你 。

Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); 

      shareIntent.setType("image/*"); 

      shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); 

      Uri uri = Uri.parse("file://"+combinedFilepath.trim()); 
       String extraString="set"; 
       shareIntent.putExtra(Intent.EXTRA_TEXT,extraString);          
       shareIntent.putExtra(Intent.EXTRA_STREAM, uri); 
       shareIntent.putExtra(Intent.EXTRA_TITLE, extraString); 
       shareIntent.putExtra(Intent.EXTRA_SUBJECT, "app name");   

       startActivity(Intent.createChooser(shareIntent, "Share via")); 
+0

我只想上傳這些圖片:http://dev2.mercuryminds.com/website/var/tmp/thumb_6880_123_chitrangada-singh-john-abraham-and-prachi-desai_thumb_bolly__forfeed.jpeg?it is possible ... – user2218667 2013-04-22 10:00:51

+0

我沒有得到任何圖像。它說404文件沒有找到 – itsrajesh4uguys 2013-04-22 10:12:57

+0

你不能上傳它。 – itsrajesh4uguys 2013-04-22 10:13:22