我需要帮助将可绘制的文本和图像发布到 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);
}