Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Button button = (Button) findViewById(R.id.button);
- button.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- String facebookUrl = "https://www.facebook.com";
- try {
- Intent i = new Intent(Intent.ACTION_VIEW);
- String facebookUrlScheme = "fb://facewebmodal/f?href=" + facebookUrl;
- i.setData(Uri.parse(facebookUrlScheme));
- startActivity(i);
- } catch (Exception e) {
- // Abrir o link no navegador se o aplicativo do Facebook não estiver instalado
- Intent i = new Intent(Intent.ACTION_VIEW);
- i.setData(Uri.parse(facebookUrl));
- startActivity(i);
- }
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement