Advertisement
Sketchware

Abrir link externo

Jan 9th, 2023
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.33 KB | None | 0 0
  1. Button button = (Button) findViewById(R.id.button);
  2. button.setOnClickListener(new View.OnClickListener() {
  3.     @Override
  4.     public void onClick(View v) {
  5.         String url = "https://www.example.com";
  6.         Intent i = new Intent(Intent.ACTION_VIEW);
  7.         i.setData(Uri.parse(url));
  8.         startActivity(i);
  9.     }
  10. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement