Change button text and action - android development

 
 
 
final Button testButton = (Button) findViewById(R.id.button1);
testButton.setTag(1);
testButton.setText("Edit");
testButton.setOnClickListener( new View.OnClickListener() {

@Override
public void onClick (View v) {
final int status =(Integer) v.getTag();
if(status == 1) {
    mPlayer.start();
    testButton.setText("Done");
    v.setTag(0); //pause
} else {
    testButton.setText("Edit");
    v.setTag(1); //pause
} 

Comments

Popular posts from this blog

How to draw an overlay on a SurfaceView used by Camera on Android?

Android TCP Connection Chat application

Create EditText with dropdown in android