android - German unicode letters don't show up in app -


i have problem language encoding... try incorporate random motivational string app contains german unicode letters... far know, java uses unicode-16, respective letters dont show @ when start app. i'm using android studio , app tested on real device.

public class start extends actionbaractivity {  //this string array containing quotes string[] motivational = {"unser größter ruhm ist nicht, niemals zu fallen, sondern jedes mal wieder aufzustehen.\nralph waldo emerson"};  public int randint() {     random rand = new random();     return rand.nextint((motivational.length) + 1); }  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_start);      //takes random quote list , sets textviews content     textview motivator = (textview) findviewbyid(r.id.motivator);     motivator.settext(motivational[randint()]); }  //rest of class 

add text strings.xml , use android's getresources.getstring() method text

<resources>    <string name="motivational">unser größter ruhm ist nicht, niemals zu fallen, sondern jedes mal wieder aufzustehen.\nralph waldo emerson</string>  </resources> 

then in java file, use

    string motivational = getresources().getstring(r.string.motivational);     textview motivator = (textview) findviewbyid(r.id.motivator);     motivator.settext(motivational); 

retrieving value strings.xml done using

getresources().getstring(r.string.motivational)  

where r.string.motivational unique string identifier.

isn't output looking for?

enter image description here


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

Mutual information between two matrices in R -