hyperlink URL

Put your problem here if it does not fit any of the other categories.

hyperlink URL

Postby zahidalinaqvi » Thu Aug 21, 2008 11:56 am

i want to open www.yahoo.com
so i want to make a hyper link as named CLICK HERE on my Activity.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. t = (TextView) findViewById(R.id.text);
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <TextView
  2.  
  3.         android:id="@+id/text"
  4.  
  5.         android:layout_width="wrap_content"
  6.  
  7.         android:layout_height="wrap_content"
  8.  
  9.         android:autoLink="all"
  10.  
  11.         android:text="http://www.yahoo.com"/>
  12.  
  13.  
Parsed in 0.001 seconds, using GeSHi 1.0.8.4


but its showing URL name but i want CLICK HERE instead of this.
and also i want to open this site on another window.
User avatar
zahidalinaqvi
Developer
Developer
 
Posts: 35
Joined: Mon Aug 11, 2008 8:54 am
Location: Jaipur India

Top

Postby plusminus » Mon Sep 08, 2008 9:55 pm

Hello zahidalinaqvi,

you either need to set an OnClickListener to that textView (using [font=Courier New]this.findViewById(R.id.text).setOnClickListener(new OnClick....{...}[/font]). Then you'll need to launch an Intent with VIEW-Action to open the browser.
Or have a look for "linkify" in the Android Documentation.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby zahidalinaqvi » Tue Sep 09, 2008 6:31 am

when i m giving a URL name like (http://www.abcd.com) then it will automatically open web page but i want a hyperlink as named click here and when click on that it should open web page.

How it is possible....
User avatar
zahidalinaqvi
Developer
Developer
 
Posts: 35
Joined: Mon Aug 11, 2008 8:54 am
Location: Jaipur India

Postby cassianotartari » Thu Sep 11, 2008 2:22 am

What you need is here .
public class pessoa {
private String nome = "Cassiano Tartari";
private String url = "www.cassianotartari.eng.br"
}
User avatar
cassianotartari
Developer
Developer
 
Posts: 28
Joined: Thu Aug 28, 2008 3:42 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 30 guests