I read the documents of Linkify and know how to make a Hyperlink Textview and open browser when user clicks on it, but is there anyway to make a textview(also with a hyperlink look, blue and clickable) but actually shows a map with a pinned location when user clicks on it, for example, in a table:
location [some address]
"some address" appears to be a link, but when you click it, instead of showing a web, it shows you a map with the actually address pinned?
Thanks!
To make them active, you need to // call setMovementMethod() on the TextView object. TextView t2 = (TextView) findViewById(R. id. text2); t2.
In Android, the most common way to show a text is by TextView element. The whole text in the TextView is easy to make clickable implementing the onClick attribute or by setting an onClickListener to the TextView.
The native Android Google Maps app (if available on device) will respond to standard http://maps.google.com URLs and query strings, so something like the following will work:
TextView t = (TextView) findViewById(R.id.mytextview);
t.setText(Html.fromHtml(
"Location " +
"<a href=\"http://maps.google.com/maps?q=1+Infinite+Loop,+Cupertino,+Santa+Clara,+California+95014\">" +
"1 Infinite Loop, Cupertino, Santa Clara, California 95014" +
"</a>"));
t.setMovementMethod(LinkMovementMethod.getInstance());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With