I’ve been working on a random string generator that displays the string at the top of the page. That part works fine. But at the bottom of the page I have a hyperlink the adds the string to the end of the url (to essentially google the string). My issue is the hyperlink stops after the first word in multi-word strings. For example, youtube.com/user/dude works fine, while youtube.com/user/lady gaga official does not because the hyperlink only highlights “youtube.com/user/lady”, leaving the rest as just plain text.
How can I include all this without ruining the already displayed strings at the top of the screen?
Thanks!
Here’s my code for the hyperlink:
Resources res = getResources();
myString = res.getStringArray(R.array.myArray);
String q = myString[rgenerator.nextInt(myString.length)];
btn.setText("http://www.allmusic.com/search/artist/"+q);
Here’s a picture of my issue:
This should do the trick. I’ve replaced all whitespaces with “”, you can substitute anything you’d want though, an underscore “_” perhaps ?