autoLink for map not working

前端 未结 2 1040
没有蜡笔的小新
没有蜡笔的小新 2021-01-04 19:23

I have the following TextView in my XML layout file:-



        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-04 19:51

    Alternative to it, in case if autolink doesn't work

    Add links to your texview . Get it underline as folows :

    SpannableString spanStr = new SpannableString(buf.toString());
    spanStr.setSpan(new UnderlineSpan(), 0, spanStr.length(), 0);
    iTextView.setText(spanStr);
    

    Use the following code to open it with map app on click as follows :

    Intent geoIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("geo:0,0?q="
                                    +iTextView.getText().toString()));
    startActivity(geoIntent);
    

提交回复
热议问题