Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appending a TextView

Tags:

android

I have an app which at current will on the press of a button eg. the number 1 button change a text view to have the number 1 in it. What i need to do is append the view so that say when the number 3 is pressed the text view will say 13 instea of just 3. Here is the switch statement i'm using to handle the button presses.

@Override
public void onClick(View c) {

    switch (c.getId()) 
    {
        case R.id.keypad_1:
            TextView prs1 = (TextView) findViewById(R.id.diff);
            prs1.setText("1");

    }

}
like image 843
nexus490 Avatar asked Mar 03 '12 16:03

nexus490


Video Answer


1 Answers

Use the TextView.append() method.

like image 199
Maz Avatar answered Oct 14 '22 23:10

Maz