Return to the basic programme after interruption from the listener



  • Hello.

    I write a programme that continuously updates certain data. From time to time, different listeners work and the programme is interrupted.

    Would it be useful to clarify whether the UI flow back to the main programme after the interruption(s) occurred to the point where the interruption occurred?

    Thank you so much for the answers.

    Examp a simplified example:

          /*Объявляем кнопку в основном классе*/
          Button button;
    

    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

          /* Здесь ставим слушателя*/
    
        button.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                /*Какой-то код, выполняющийся, при нажатии кнопки*/
            }
        });
    
          /* Здесь какой-то код */
    
          // Начинаем выполнять основную программу по обновлению данных
          mMainHandler.post( new MainProgramCycle() );
        }
    }
    

    class MainProgramCycle implements Runnable{

    @Override
    public void run() {
    
    
                /*Код основной программы*/
    
                 /** Обновить данные через 200 мс  */
                  mMainHandler.postDelayed( new MainProgramCycle(), 200 );
    }
    

    }



  • In fact, usually the basic program and waits for any of the listeners to work, then the student code is met when it is completed, the program is waiting again for other listeners to act.

    I can't even imagine what you've described, but apparently, after the student's code has been completed, it's gonna be "when you've stopped" because there's challenge to the method of returning to the location of the challenge.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2