title: How do i make that it will say the text to speech only once by logic ?
body: <p>On the pc in c# this is the webserver i have this part:</p>
  
  <pre><code>private void cases()
  {
      if (request.QueryString[0] == "uploadstatus")
                      {
                          switch (Youtube_Uploader.fileuploadstatus)
                          {
                              case "uploading file":
                                  return "uploading";
  
                              case "file uploaded successfully":
                                  Youtube_Uploader.fileuploadstatus = "";
                                  return "upload completed";
  
                              default:
                                  return "upload unknown state";
                          }
                      }
  }
  </code></pre>
  
  <p>Then i have in the client side the java using android studio this code:</p>
  
  <pre><code>Runnable serverChecksRunnable = new Runnable()
      {
          @Override
          public void run()
          {
              if (connectedSuccess == true)
              {
  
                  checkServer = Get(iptouse + "uploadstatus");
  
              }
  
              Handler h=new Handler(Looper.getMainLooper());
              h.post(new Runnable()
              {
                  @Override
                  public void run()
                  {
                      if (connectedSuccess)
                      {
                          if (checkServer != null)
                          {
                              String a = null;
                              try
                              {
                                  a = new String(checkServer, "UTF-8");
                                  textforthespeacch = a;
                                  if (textforthespeacch.equals("upload completed"))
                                      MainActivity.this.initTTS();
                                  if (textforthespeacch.equals("uploading"))
                                  {
                                      servercheckCounter += 1;
                                      if (servercheckCounter == 1)
                                      {
                                          MainActivity.this.initTTS();
                                      }
                                  }
  
  
                                  servercheckCounter = 0;
                              } catch (UnsupportedEncodingException e)
                              {
                                  e.printStackTrace();
                              }
                          }
                      }
  
                  }
              });
  
              customHandler.postDelayed(serverChecksRunnable,1000);
          }
      };
  </code></pre>
  
  <p>This line send a command to the webserver every second:</p>
  
  <pre><code>checkServer = Get(iptouse + "uploadstatus");
  </code></pre>
  
  <p>Back to the pc this is the working part: The webserver when i the case is "file uploaded successfully" i then reset the variable Youtube_Uploader.fileuploadstatus = ""; to be empty string the result is that it will say  return "upload completed"; only once.</p>
  
  <p>The problem is while it's uploading.
  When the case is: "uploading file" on the webserver it keep saying every second "uploading" but i want that it will say "uploading" also only once.</p>
  
  <p>I tried to do also to reset the variable like this:</p>
  
  <pre><code>                        case "uploading file":
                          Youtube_Uploader.fileuploadstatus = "";
                          return "uploading";
  </code></pre>
  
  <p>But it keep saying "uploading" every second.
  I tried in the java the client side code to make some checkings:</p>
  
  <pre><code>if (textforthespeacch.equals("upload completed"))
                                      MainActivity.this.initTTS();
                                  if (textforthespeacch.equals("uploading"))
                                  {
                                      servercheckCounter += 1;
                                      //if (servercheckCounter == 10)
                                      //{
                                      if (servercheckCounter == 1)
                                      {
                                          MainActivity.this.initTTS();
                                      }
  
                                      //  servercheckCounter = 0;
                                      //}
                                  }
  </code></pre>
  
  <p>So if the it's completed it's working fine saying only once.
  But when it's uploading it's saying "uploading" every second.</p>
  
  <p>Another problem might be is the first time i wanted it to say "uploading" every 10 seconds but the webserver might be uploading it before a 10 seconds passed.</p>
  
  <p>So i can't find the right logic and also how to make it work.
  I think i want to make it so it will say each status once:</p>
  
  <p>"uploading"</p>
  
  <p>"upload completed"</p>
  
  <p>But i can't make it work saying each status case once only.</p>