0

I am new to android developing.. i have only one textview like this

 <TextView
        android:id="@+id/txt"
        android:layout_width="wrap_content"
        android:autoLink="web"
        android:layout_height="wrap_content"
        android:text="@string/hello_world" />

Then i set settext for textview like

<string name="content_ontheroad">Check road conditions on your route before you leave.\nEach state or territory has a different phone number and\nwebsite detailing relevant information, or ask a local.\n\n 

\u2022&#160;&#160;&#160;ACT  13 22 81\n          
 <a href="http://www.tams.act.gov.au/roads-transport">&#160;&#160;&#160;&#160;http://www.tams.act.gov.au/roads-transport</a> \n\n
\u2022&#160;&#160;&#160;N SW 13 27 01\n 
 <a href="https://www.livetraffic.com">&#160;&#160;&#160;&#160;https://www.livetraffic.com</a> \n\n
\u2022&#160;&#160;&#160;Northern Territory 1800 246 199 or\n  <a href="http://www.securent.nt.gov.au/">&#160;&#160;&#160;&#160;http://www.securent.nt.gov.au/</a>\n\n 
\u2022&#160;&#160;&#160;Queensland 13 19 40 or\n   <a href="http://www.racq.com.au/roadconditions">&#160;&#160;&#160;&#160;http://www.racq.com.au/roadconditions</a>\n\n   
\u2022&#160;&#160;&#160;South Australia 1300 361 033 or\n 
 <a href="http://www.dpti.sa.gov.au/OutbackRoads">&#160;&#160;&#160;&#160;http://www.dpti.sa.gov.au/OutbackRoads</a>\n\n 
\u2022&#160;&#160;&#160;Tasmania 1300 135 513 or\n  <a href="http://www.dier.tas.gov.au/road_closures_and_delays">&#160;&#160;&#160;&#160;http://www.dier.tas.gov.au/road_closures_and_delays</a>\n\n  
\u2022&#160;&#160;&#160;Victoria, 13 11 70 or\n  <a href="http://www.vicroads.vic.gov.au">&#160;&#160;&#160;&#160;http://www.vicroads.vic.gov.au</a>\n\n 
\u2022&#160;&#160;&#160;Western Australia 1800 013 314 or\n<a href="https://www.mainroads.wa.gov.au/UsingRoads/RoadTrafficInformation/Pages/RoadTrafficInformation.aspx">&#160;&#160;&#160;&#160;https://www.mainroads.wa.gov.au/UsingRoads/RoadTrafficInformation/Pages/RoadTrafficInformation.aspx</a> \n\n

On country roads, always keep alert for wildlife, particularly\n at dawn or dusk when animals may be active. Be cautious,\n scanning both the road ahead and the roadsides.  Be\n aware of traffic behind you, as well as oncoming traffic.\n\n 
When safe to do so, use your high beam headlights so that\n you can see further when driving at night. However, bright\n lights can dazzle animals and rather than move off the\n road, they may remain stationery and in the path of your\n vehicle.\n\n
When travelling at speed, do not swerve to avoid hitting an\n animal, as this could put you and other motorists in danger.\n Sometimes, it may be impossible to avoid a collision with\n an animal.\n\n
More information:\n\n<a href="http://www.racv.com.au/wps/wcm/connect/racv/Internet/Primary/travel/before+you+go/driving+tips">http://www.racv.com.au/wps/wcm/connect/racv/Internet/Primary/travel/before+you+go/driving+tips</a></string>

it has some more than one link.i enable autolink to textview for open link in default browser. But i need to open it in webview within my app

manoj pari
  • 5
  • 1
  • 5

1 Answers1

0

Assuming you want to set every href to a new web view... First, have different text view for every part of your text. Then which part has href, simply set underline and colour blue or anything. Plus you can add other properties separately. Now every for every textview, give it setOnClick event and redirect them to your webview intent.

Hope this help :)

kiturk3
  • 549
  • 10
  • 30