将LinkedinFacebookTwitterMySpace集成到Android应用程序中
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了将LinkedinFacebookTwitterMySpace集成到Android应用程序中相关的知识,希望对你有一定的参考价值。
The main objective of this example is to access social media providers Facebook, Twitter and others by clicking a single button "Share".On Clicking the buttonthe api will open dialog of providers. User can access the provider from dialog
and can update the status , get friends list , user profile
public class ShareButtonActivity extends Activity { // SocialAuth Component SocialAuthAdapter adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Welcome Message TextView textview = (TextView)findViewById(R.id.text); textview.setText("Welcome to SocialAuth Demo. We are sharing text SocialAuth android by share button."); //Create Your Own Share Button share.setText("Share"); share.setBackgroundResource(R.drawable.button_gradient); // Add it to Library adapter = new SocialAuthAdapter(new ResponseListener()); // Add providers adapter.enable(share); } /** * Listens Response from Library * */ private final class ResponseListener implements DialogListener { /** * */ private static final long serialVersionUID = 1L; public void onComplete(Bundle values) { // Variable to receive message status boolean status; Log.d("ShareButton" , "Authentication Successful"); // Get name of provider after authentication Log.d("ShareButton", "Provider Name = " + providerName); try { // Please avoid sending duplicate message. Social Media Providers block duplicate messages. status = true; } { status = false; } // Post Toast or Dialog to display on screen if(status) Toast.makeText(ShareButtonActivity.this, "Message posted on " + providerName, Toast.LENGTH_SHORT).show(); else Toast.makeText(ShareButtonActivity.this, "Message not posted on" + providerName, Toast.LENGTH_SHORT).show(); } public void onError(SocialAuthError error) { Log.d("ShareButton" , "Authentication Error"); } public void onCancel() { Log.d("ShareButton" , "Authentication Cancelled"); } } }
以上是关于将LinkedinFacebookTwitterMySpace集成到Android应用程序中的主要内容,如果未能解决你的问题,请参考以下文章
Javascript 将正则表达式 \\n 替换为 \n,将 \\t 替换为 \t,将 \\r 替换为 \r 等等