1
votes

from my Android app, I would like to open a link to Social Network profile (Facebook / Twitter / Google Plus / Youtube / Linkedin) in the official Social Network app (if the app is installed, of course).

How to open Social Network profile in the official Social Network app from code?

i successfully used this code for Facebook: Now I want to do the same thing for other Social App ( Twitter / Google Plus / Youtube / Linkedin )

ImageView img = (ImageView) findViewById(R.id.fb);
        img.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {               
                try {
                    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/1531870783738030"));
                    startActivity(intent);
                } catch (Exception e) {
                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/ultimatesoftwaredeveloper")));
                }

            }
        });
1

1 Answers

1
votes

Like you did with Facebook, call Twitter using twitter://user?user_id=id_num. You can either store the ids and use them here or manually put them in your call. Cheers!

Google+:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/id_goes_here/posts")));

OR

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.google.android.apps.plus",
"com.google.android.apps.plus.phone.UrlGatewayActivity");
intent.putExtra("customAppUri", "FAN_PAGE_ID");
startActivity(intent);

Youtube:

startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:VIDEO_ID")));