string concatenation - Android send SMS message with two getString() -


i've got problem sending sms android app. in strings.xml have text1 , text2 text. when i'm trying send sms 1 string, e.g

sms.sendtextmessage(number, null,message, null,null); 

where message getstring(r.string.text1) works fine. need send string text = getstring(r.string.text1) + somevariable + getstring(r.string.text2); doesn't work. i've tried make getresources().getstring() in both still nothing, it's not sending;/ doing wrong?

you can use string builder append string , put together.

stringbuilder sb = new stringbuilder(some_appropriate_size); sb.append(getresources().getstring(r.string.text1)); sb.append(somevariable); sb.append(getresources().getstring(r.string.text2));  string final_string =  sb.tostring();  

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -