Last Update - 17 Oct 2017

How to create dynamic string

How to create dynamic string

Method for add some dynamic value to any string either value can string or integer. First of all create a resource in your string.xml.


Lest take a example of version code of your application:


<string name="app_version">App Name (v%s)</string>


%s used for String, but you can use otrher identifiers like:

%s used for String.

%d used for Integer


 TextView app_version = (TextView) view.findViewById(;
 app_version.setText(getString(R.string.app_version, BuildConfig.VERSION_NAME));



App Name (v2.0.1)





Did you find this page helpful? X