我需要帮助才能将文字和图片发布到twitter上。以下是我的代码。我尝试过但总是失败。有人可以帮帮我吗。
private void ShareTwitter(){
if (campaign == null) {
finish();
}else {
String message =rewardItemTextView.getText().toString()+" "+"#TEST";
try {
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri uri = Uri.parse("content://com.tes.activities/bbq.png");
// Uri uri = Uri.parse("file:///android_assets/bbq");
sharingIntent.setType("image/*");
sharingIntent.setClassName("com.twitter.android","com.twitter.android.PostActivity");
sharingIntent.putExtra(Intent.EXTRA_TEXT, message );
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
startActivity(sharingIntent);
} catch (Exception e) {
Intent i = new Intent();
i.putExtra(Intent.EXTRA_TEXT, message);
i.setAction(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://mobile.twitter.com/compose/tweet"));
startActivity(i);
}