在我的应用中,我想在按钮单击中将照片发布。
因此,我使用了很多代码,但不起作用。因此,我想获得代码,一点击在Twitter中共享照片
在提出问题之前。尝试搜索Google或搜索类似问题。
请参阅此处:请参阅此处
尝试以下:
Intent targetedShare = new Intent(android.content.Intent.ACTION_SEND);
targetedShare.setType("image/jpeg"); // put here your mime type
targetedShare.putExtra(Intent.EXTRA_TEXT, "My body of post/email");
targetedShare.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(imagePath)) );
Intent chooserIntent = Intent.createChooser(targetedShare, "Select app to share");
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, targetedShare);
startActivity(chooserIntent);