我是新的android系统,我在分享内容时遇到了一些问题。 我做了一个涉及测试的android应用程序。在过去的活动,我想提供共享通过shareintent用户结果的机会,这里的代码框架:在Facebook上分享文字/图像
display= (TextView) findViewById (R.id.tvDisplay);
display.setText("Well Done, your score is" + score); //score is an int
sharebutton= (Button)findViewById(R.id.sharebutton);
sharebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
results = display.getText().toString();
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT,"My score in the test is" + results);
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "TEST");
startActivity(Intent.createChooser(shareIntent, "Share.."));
}
});
的问题是,当我按一下按钮,我可以分享的确切所有共享工具(电子邮件,wapp等)中的文本,但不通过Facebook。为什么? 我试图允许发布图像和文字在FB墙上,但我无法给出可绘制文件夹上的图像的确切路径。 谢谢你的所有建议。在SD卡,然后共享图像
看看这个:http://stackoverflow.com/questions/24709929/share-image-is-not-working-via-action-send/24710176#24710176 –
嗨,我试过你的尝试,但它doesn'吨工作。当我点击FB图标时,我只能在我的FB墙上张贴一些东西,而不张贴图像。我写了File myFile = new File(Environment.getExternalStorageDirectory()+“/ ic_launcher.png”); - 我试图张贴启动器图标来测试它。 – Lordiron