That is the question, my application works with the server and there are several addresses where the application communicates with the server

This is how it looks

<string name="url_app_login">http://52.58.65.000/applogin</string> <string name="url_create_user_avatar_response">http://52.58.65.000/createuseravatarrespone</string> <string name="url_create_user_avatar">http://52.58.65.000/createuseravatar</string> <string name="url_app_reg">http://52.58.65.000/appreg</string> <string name="url_app_res_pass">http://52.58.65.000/apprespass</string> <string name="url_get_avatar">http://52.58.65.000/mservices/getuseravatar/id=</string> <string name="url_check_name_exist">http://52.58.65.000/checknameexist</string> <string name="url_reg_user">http://52.58.65.000/reguser</string> 

Is it possible to somehow make http://52.58.65.000/ in a variable and the rest to be added?

Without putting it into the code so that it would continue to be all the resources ...

    1 answer 1

    I'm afraid this is impossible. Probably you should put the host address in a separate string resource and the various paths are also separate and in the code itself is concatenated. That is, you have a row server

     <string name="server">http://server</string> 

    And there are separate ways

     <string name="path1">path1</string> <string name="path2">path2</string> 

    The path itself is declared as follows.

     <string name="url">%s/%s</string> 

    Well, actually in the code

     Resources res = getResources(); String url = res.getString(R.string.url, res.getString(R.string.server), res.getString(R.string.path1)); 
    • I looked here, you can without getResources (). Directly call getString () - plesser