0

Hey all, so I have a start and a stop button. What I would like to happen is once the start button is clicked, it disappears and the stop button shows up right in the spot of the start button so that the stop button is able to be clicked. Is this done by switch statements?

//Start Button btnstart.setOnClickListener(new OnClickListener() { public void onClick(View v) { ... } }); //Stop Button btnstop.setOnClickListener(new OnClickListener() { public void onClick(View v) { ... } } }); 
4
  • This has nothing to do with eclipse... Commented Jan 27, 2011 at 1:05
  • @Mayra what are you talking about? This is definitely for android eclipse Commented Jan 27, 2011 at 19:19
  • @dtmilano i need 2 for a countdowntimer. (Start/Reset, Stop) Commented Jan 27, 2011 at 19:20
  • Eclipse is a text editor. It does not in any way affect the running the Android code. You could write the code in NotePad, compile it on the command line and it would do the same thing. Commented Jan 27, 2011 at 19:41

1 Answer 1

5

Try setVisibility with the two buttons adjacent in your layout:

//Start Button btnstart.setOnClickListener(new OnClickListener() { public void onClick(View v) { btnstart.setVisibility(View.GONE); btnstop.setVisibility(View.VISIBLE); } }); //Stop Button btnstop.setOnClickListener(new OnClickListener() { public void onClick(View v) { btnstop.setVisibility(View.GONE); btnstart.setVisibility(View.VISIBLE); } } }); 
Sign up to request clarification or add additional context in comments.

1 Comment

thanks, it worked just the way i wanted it to. can't believe i didnt think of that

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.