K
K
kolodach2014-02-24 15:23:49
Java
kolodach, 2014-02-24 15:23:49

else java android not working?

private int currentId = 0;

.....

public void onStartClicked() {
    Log.d(TAG, "start button clicked");
    if (lvData.getId() == currentId){
      Log.d(TAG, "виполнилось условие if");
      m_stopwatchService.start();
    }
    else {
      Log.d(TAG, "виполнилось условие else");
      m_stopwatchService.reset();
      m_stopwatchService.start();		
    }
    currentId=lvData.getId();
    showPauseButton();
  }

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
kolodach, 2014-02-27
@kolodach

Thanks, I decided =) I get the position from the onItemClick method and set it equal to its value, then it works

K
Konstantin Dovnar, 2014-02-24
@SolidlSnake

From the piece of code that you gave, we can only assume that id is always equal to currentId.

K
kolodach, 2014-02-24
@kolodach

So it is, but I don't understand why. Variables are used only in this method, so I see no reason to throw all the code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question