Jump to content

Lien dans bouton


Recommended Posts

Button bouton = (Button) findViewById(R.id.mybouton);
bouton.setOnClickListener(new View.OnClickListener() {
				public void onClick(View v) {
                   String url = "http://www.example.com";
                   Intent i = new Intent(Intent.ACTION_VIEW);
                   i.setData(Uri.parse(url));
                   startActivity(i);	
				}
				});
 

et dans le R.id.bouton le bouton à la fin représente l'identifiant de ta vue Button que tu as dans ton xml donc adapte le en fonction de l'id que tu as.

 

Si t'arrives pas à faire un truc aussi basique faudrait que tu relise ton tuto parce que t'avanceras pas si tu sais pas faire ça.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...