Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Java - String Variable inside a String?

I am looking for a solution to add inside a String URL a variable (Post parameter).

SharedPreferences sp = getPreferences(MODE_PRIVATE);    
String my_variable = "test";
private  static final String READ_COMMENTS_URL = "http://xxx/comments.php?usernames= my_variable";  

It should eventually possible with string.format. Can anyone give a hint?

like image 762
dA_uNknOwN Avatar asked Jun 08 '26 14:06

dA_uNknOwN


1 Answers

SharedPreferences sp = getPreferences(MODE_PRIVATE);    
String my_variable = "test";
private  static final String READ_COMMENTS_URL = "http://xxx/comments.php?usernames= "+my_variable;
like image 139
PPD Avatar answered Jun 10 '26 02:06

PPD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!