首先,我的应用程序的功能是阅读文章。当用户阅读文章并且他想将文章分享给Facebook或其他人时,我找不到该类型的链接/超链接。
这是我的分享功能
private void shareIt() {
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.setType("text/plain");
String shareBody = "Here is the share content body";
sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Subject Here");
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(sharingIntent, "Share via"));
}
我想要的是使用计算机阅读文章并获得分享按钮时的共享功能。在共享媒体中,它将显示为文章的内容而不是纯文本。
那么,如何编辑代码以便我可以共享链接?
请在Manifest.xml上指导我,我不确定interfilter是否也需要添加哪个类别。
其次,我看到了共享列表,内置列表对我不太好,因为我想要那些facebook,sina,twitter而不是google,gmail,bluetooth,line或messaging。
那么,如何通过java实现共享列表?
答案 0 :(得分:0)
可能是这样的
sharebtn = new Custom_ButtonField(share, shareactive, shareactive) {
protected boolean navigationClick(int status, int time) {
if (Config_GlobalFunction.isConnected()) {
String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
String APPLICATION_ID = "153555168010272";
String APPLICATION_SECRET = "354f91a79c8fe5a8de9d65b55ef9aa1b";
String[] PERMISSIONS = Facebook.Permissions.USER_DATA_PERMISSIONS;
ApplicationSettings as = new ApplicationSettings(
NEXT_URL, APPLICATION_ID, APPLICATION_SECRET,
PERMISSIONS);
Facebook fb = Facebook.getInstance(as);
try {
User user = fb.getCurrentUser();
user.publishStatus(Config_GlobalFunction.sharelink
+ newsid);
} catch (FacebookException e) {
}
} else
Config_GlobalFunction.Message(
Config_GlobalFunction.nosharenews, 1);
return true;
}
};
add(sharebtn);
前提条件:您必须导入BB facebook sdk。