Q:

to set button text at runtime with already set text

I want to display arraylist size in buttonText .Button text already set in xml file as "SHOW" . I want that "show(size of array)".
how to do this.
I already got the size of array in a variable named size as below.
public int CountRecord(ImageItemBin bin)
{
    showImagelist.add(showBin);
    int size=showImagelist.size();
    tvcounter.setText(Integer.toString(size));
    return 0;
}

A:

There is a batter way using strings.xml
All you have to do is create a new string in string xml with %s sign
for example (%s for string value %d for int value )
 <string name="button_text_show">show %d</string>

now in your java code you do something like this
btnShow.setText(getString(R.string.button_text_show,size));

This will add size to your previous show text .%dis an kind of an indicator that some digit value will come here.

