의도

2012-03-07 8 views
1
이 버그가 년 동안보고되지 않고 내가 해결 방법은 여기에 언급하려고 아직

http://forum.developers.facebook.net/viewtopic.php?id=93900의도

http://bugs.developers.facebook.net/show_bug.cgi?id=16728

수정되었습니다

, 그렇지 않은 안드로이드를 통해 페이스 북에 텍스트와 이미지를 공유 할 수 없습니다 어느 쪽이든 일하십시오. 나는

How to share photo with CAPTION via Android share intent on Facebook?

진정한 해결 방법은 다음 무엇 페이스 북 버전 1.8.3을 사용하고 있습니다?

답변

0

안드로이드 응용 프로그램의 Facebook 또는 Twitter에서 뭔가를 공유하려면 먼저 Android SDK 및 Twitter SDK에 응용 프로그램을 통합해야합니다. 당신은 이러한 통합 bethout이를 공유 할 경우에 당신은 ... 간단하게 아래처럼 의도를 전송하여 페이스 북과 트위터 APK 코드 위의 작업 장치/에뮬레이터에 설치해야

public class MainActivity extends Activity { 

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 

    // listeners of our two buttons 
    View.OnClickListener handler = new View.OnClickListener() { 
     public void onClick(View v) { 
      switch (v.getId()) { 

      case R.id.buttonShareTextUrl: 
       shareTextUrl(); 
       break; 

      case R.id.buttonShareImage: 
       shareImage(); 
       break; 
      } 
     } 
    }; 

    // our buttons 
    findViewById(R.id.buttonShareTextUrl).setOnClickListener(handler); 
    findViewById(R.id.buttonShareImage).setOnClickListener(handler); 

} 

/* 
* Method to share either text or URL. 
*/ 
private void shareTextUrl() { 
    Intent share = new Intent(android.content.Intent.ACTION_SEND); 
    share.setType("text/plain"); 
    share.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET); 

    // Add data to the intent, the receiving app will decide 
    // what to do with it. 
    share.putExtra(Intent.EXTRA_SUBJECT, "Title Of The Post"); 
    share.putExtra(Intent.EXTRA_TEXT, "http://two55am.com"); 

    startActivity(Intent.createChooser(share, "Share link!")); 
}  

/* 
* Method to share any image. 
*/ 
private void shareImage() { 
    Intent share = new Intent(Intent.ACTION_SEND); 

    // If you want to share a png image only, you can do: 
    // setType("image/png"); OR for jpeg: setType("image/jpeg"); 
    share.setType("image/*"); 

    // Make sure you put example png image named myImage.png in your 
    // directory 
    String imagePath = Environment.getExternalStorageDirectory() 
      + "/twitter.png"; 

    File imageFileToShare = new File(imagePath); 

    Uri uri = Uri.fromFile(imageFileToShare); 
    share.putExtra(Intent.EXTRA_STREAM, uri); 

    startActivity(Intent.createChooser(share, "Share Image!")); 
} 

} 

참고이 작업을 수행 할 수 있습니다 .

+0

Facebook은 EXTRA_SUBJECT를 구문 분석하지 않습니다. – user1