Advertisement
Sketchware

Abrir link com Google Chrome

Feb 8th, 2023
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.37 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.         i.setPackage("com.android.chrome");
  9.         startActivity(i);
  10.     }
  11. });
  12.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement