Why can't use the same Span object to setSpan above twice?
<p>Why can't use the same Span object  to setSpan above twice?</p>

<p>SpannableString ss = new SpannableString("aaaaa[1]bbbb[1]cccc[1]"); </p>

<p>I need to replace all the [1] with a image. If I use the following code, only the last one is replaced by the image:</p>

<pre><code>etShow = (EditText) findViewById(R.id.show);
SpannableString ss = new SpannableString("aaaaa[1]bbbb[1]cccc[1]");
int[] starts = new int[3];
int[] ends = new int[3];
int h = 0;
int k = 0;
for (int i = 0; i &lt; ss.length(); i++) {
    if (ss.charAt(i) == '[') {
    starts[h] = i;
    h++;
    } else if (ss.charAt(i) == ']') {
    ends[k] = i;
    k++;
    }
    }

Drawable d = getResources().getDrawable(R.drawable.ic_launcher);
        d.setBounds(0, 0, 50, 50);
        ImageSpan im = new ImageSpan(d);

for(int i=0;i&lt;3;i++){
        ss.setSpan(im, starts[i], ends[i]+1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);   
        }
etShow.getText().insert(0, ss);
</code></pre>

<p>If change to the following code， all the [1] are replaced by the image.</p>

<pre><code>Drawable d = getResources().getDrawable(R.drawable.ic_launcher);
        d.setBounds(0, 0, 50, 50);
        ImageSpan im = new ImageSpan(d);
        ImageSpan im1 = new ImageSpan(d);
        ImageSpan im2 = new ImageSpan(d);
        //for(int i=0;i&lt;3;i++){
//      ss.setSpan(im, starts[i], ends[i]+1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        ss.setSpan(im, starts[0], ends[0]+1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        ss.setSpan(im1, starts[1], ends[1]+1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
        ss.setSpan(im2, starts[2], ends[2]+1, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
    //  }
</code></pre>

<p>How can explaint this?</p>
