Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Open facebook, twitter and linkedIn user profile using username

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.09k
    Comment on it

    Sometimes we need to open user profile of Facebook, Twitter or LinkedIn by using the username in android.

    To do this, we just create a uri to open the profile.

    We can implement this in onclick() of any view.

    For Facebook:

    String url = "https://www.facebook.com/"+mFacebookUrlString;
                Intent facebookAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                facebookAppIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                startActivity(facebookAppIntent);
    

    For Twitter:

    String url = "https://www.twitter.com/"+mTwitterUrlString;
                Intent twitterAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                twitterAppIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                startActivity(twitterAppIntent);
    

    For LinkedIn:

    String url = "https://www.linkedin.com/in/"+mLinkedInurlString;
                Intent linkedInAppIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
                linkedInAppIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
                startActivity(linkedInAppIntent);
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: