Making a link clickable in xml & java

  • Pretty new to java. Already tried to implement existing tutorials but couldn't get it to work. Can someone tell me what to change in my HomeFragment.java to make the link clickable in the app?

    XML:


    Code: strings.xml
    <string name="teststring"> <a href="https://google.com">test</a></string>


  • Hallo
    Erstens sind wir ein deutsches Forum und wollen es auch bleiben.
    Bitte schreib in deutsch.


    In einen Fragment kannst du keinen „onClick“ im XML benutzen.
    Implementiere das Interface OnClickListener in deine Kasse.


    In der onCreateView holst du dir die Id deiner TextView und stets darauf den Listner.
    Für das "findViewById" brauchst du das "Layout, View" oder den "Context" der Activity.
    getActivity()


    Edited once, last by nono124 (December 21, 2019 at 10:04 AM).

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!