I\'m currently rendering HTML input in a TextView like so:
tv.setText(Html.fromHtml(\"test\"));
The HTML b
Just to share an alternative solution using a library I created. With Textoo, this can be achieved like:
TextView locNotFound = Textoo
.config((TextView) findViewById(R.id.view_location_disabled))
.addLinksHandler(new LinksHandler() {
@Override
public boolean onClick(View view, String url) {
if ("internal://settings/location".equals(url)) {
Intent locSettings = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(locSettings);
return true;
} else {
return false;
}
}
})
.apply();
Or with dynamic HTML source:
String htmlSource = "Links: Google";
Spanned linksLoggingText = Textoo
.config(htmlSource)
.parseHtml()
.addLinksHandler(new LinksHandler() {
@Override
public boolean onClick(View view, String url) {
Log.i("MyActivity", "Linking to google...");
return false; // event not handled. Continue default processing i.e. link to google
}
})
.apply();
textView.setText(linksLoggingText);