What's the best way to check if a String contains a URL in Java/Android?

前端 未结 10 1273
轮回少年
轮回少年 2020-12-02 21:18

What\'s the best way to check if a String contains a URL in Java/Android? Would the best way be to check if the string contains |.com | .net | .org | .info | .everythingelse

10条回答
  •  盖世英雄少女心
    2020-12-02 21:30

    The best way is to to set the property autolink to your textview, Android will recognize, change the appearance and make clickable a link anywhere inside the string.

    android:autoLink="web"

提交回复
热议问题