Advertisement
Sketchware

Untitled

Jan 7th, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // Obtém a referência para o EditText
  2. EditText editText = (EditText) findViewById(R.id.nome_do_seu_edittext);
  3.  
  4. // Obtém o texto inserido no EditText
  5. String link = editText.getText().toString();
  6.  
  7. // Cria a intenção de abrir um link
  8. Intent intent = new Intent(Intent.ACTION_VIEW);
  9.  
  10. // Define o link a ser aberto
  11. intent.setData(Uri.parse(link));
  12.  
  13. // Inicia a atividade para abrir o link
  14. startActivity(intent);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement