得到的TextView,机器人Linkified文字...? [英] get Linkified text from textview-android...?
问题描述
我在我的Android应用程序一个TextView。
I have a textview in my android application.
textView.setText(message);
Linkify.addLinks(textView, Linkify.ALL);
本code将其识别电话号码,电子邮件地址,网页链接等,并突出它的点击,所以适当的意图电话。
with this code it identify phone number,email address, weblink etc. and highlight it for click, so appropriate intent call.
我想取什么linkify在我的TextView其存储在一个数组
例如:
I want to fetch whatever linkify in my textview store it in an array example
如果我的TextView包含你好,这是鹿,我的电话号码是9988776655和电子邮件ID是abc@gmail.com和WEBURL是www.abc.com
字符串
if my textview contains "Hello, this is deer, my phone number is 9988776655 and email id is abc@gmail.com and weburl is www.abc.com"
string
然后我想获取9988776655,abc@gmail.com,www.abc.com并存储在阵列中,
是否有可能?!?!
then I want to fetch "9988776655","abc@gmail.com","www.abc.com" and store it in array, is it possible...!?!
推荐答案
您可以使用<一个href=\"http://developer.android.com/reference/android/widget/TextView.html#getUrls%28%29\">TextView#getUrls像这样调用 Linkify
之后:
You can use TextView#getUrls after the call to Linkify
like this:
URLSpan spans[] = textView.getUrls();
for(URLSpan span: spans) {
Log.d(TAG, span.getURL());
}
这篇关于得到的TextView,机器人Linkified文字...?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!