如何在Android中通过选项实现共享? [英] How to implement share via option in android?
本文介绍了如何在Android中通过选项实现共享?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想实现类似这样的东西. 共享
I want to implement something like this.
不应对其进行硬编码.如果用户尚未安装Dropbox,则不应选择通过Dropbox进行共享.
It should not be hard coded. If user haven't installed Dropbox there should not be a option to share via Dropbox.
提前谢谢!
推荐答案
您可以使用以下方法进行同样的操作:
You can do the same by using:
Intent i=new Intent(android.content.Intent.ACTION_SEND);
i.setType("text/plain");
i.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject test");
i.putExtra(android.content.Intent.EXTRA_TEXT, "extra text that you want to put");
startActivity(Intent.createChooser(i,"Share via"));
这里有详细的示例供您参考: http ://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/
Detailed example is here for your reference: http://mobile.tutsplus.com/tutorials/android/android-sdk-implement-a-share-intent/
这篇关于如何在Android中通过选项实现共享?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文