Android Share Intent

☆樱花仙子☆ 提交于 2019-12-23 06:12:58

问题


How can implement an intent for sharing some text in a dialog like this ?


回答1:


Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_STREAM, Uri.parse(filePath));
try
{
    startActivity(Intent.createChooser(intent, "Sending File..."));
}



回答2:


There u are:

Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_TEXT, YOUR_TEXT_TO_SEND);
startActivity(Intent.createChooser(intent, "Share with"));



回答3:


You can also use my library Android Intents. See demo app for details



来源:https://stackoverflow.com/questions/9517545/android-share-intent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!