I want to show some sort of "formatted" text in my activity.
Some words within this textView (bold formatted for example) should be clickable
A toast message should be displayed when the user clicks on them.
Is there a possibility to do this in Android?
Thank you
I probably got a better and more flexible solution for me
I can use webview, html and javascript functions within the call methods in my android application.
Public Class Expands Menuscreen Activity Created Before * / @Override Public Zero OnCreate (bundled savedInstanceState) {super.onCreate (savedInstanceState); WebView webview = new webview (this); SetContentView (webview); String data = "test and lieutenant; u onclick = \" show Android test ('test') \ "& gt; this & lt; / u & gt;"; String js_data = "& lt; script type = \" text / javascript \ "& gt; function show androidtost (toast) {Android.showToast (toast);}} ; Webview.loadData (data + js_data, "text / html", "utf-8"); Webstings webSettings = webview.getSettings (); WebSettings.setJavaScriptEnabled (true); Webview.addJavascriptInterface (new JavaScript Interface (this), "Android"); } Public class JavaScript interface {reference mContext; / ** Interface the interface and set the reference * / JavaScriptInterface (reference c) {mContext = c; } / ** Show a toast from the web page * / public Zero Show Toast (String Toast) {Toast. Make text (mContext, toast, toast.LENGTH_SHORT). Show (); }}}
Comments
Post a Comment