title: Program Output not showing
body: <p>I have this program, I've been working on it a while; I recently changed the programs layout to include two classes instead of just one, originally, I had all my code within the MainActivity class, now I have split the program between two classes, MainActvitiy and ReverseString.</p>
  <p>Since I've done this, the program output no longer shows on the button press. It still seems to work just fine, I don't get errors and the program doesn't crash. I assume there is a logical error somewhere in the code but I can't find it.</p>
  <p>Here's my two classes.</p>
  <p>MainActivity.kt</p>
  <pre><code>package com.example.stringreversal
  
  // program imports
  import android.annotation.SuppressLint
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import android.widget.Button
  import android.widget.EditText
  import android.widget.TextView
  
  class MainActivity : AppCompatActivity() {
  
      private val myVariable = ReverseString()
  
      @SuppressLint(&quot;SetTextI18n&quot;)
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          // defines button and locates it in activity_main.xml
          val button = findViewById&lt;Button&gt;(R.id.useButton)
  
          // sets an OnClickListener to the button, runs code below when clicked / pressed
          button.setOnClickListener {
              // defines UI elements and locates them in activity_main.xml
              val userInput = findViewById&lt;EditText&gt;(R.id.userInput).text.toString()
              val exclusion = findViewById&lt;EditText&gt;(R.id.restrictedChars).text.toString()
  
              val output = myVariable.reverse(userInput, exclusion)
  
              val programOutput = findViewById&lt;TextView&gt;(R.id.programOutput)
  
              programOutput.text = output
          }
      }
  }
  </code></pre>
  <p>ReverseString.kt</p>
  <pre><code>package com.example.stringreversal
  
  class ReverseString {
      fun reverse(userInput: String, exclusion: String): String {
          // splits user inputted string by whitespace; gets size of the returned list; defines wordPointer as 0
          val wordsInString = userInput.split(&quot; &quot;)
          val wordsSize = wordsInString.size
          var wordPointer = 0
          val list = arrayListOf&lt;String&gt;()
  
          // while wordPointer is less than wordsSize...
          while (wordPointer &lt; wordsSize) {
              // defines the current word in the string by locating the index at [wordPointer]
              val currentWord = wordsInString[wordPointer]
              // defines a character array to store the current word, split into characters
              val charArray = currentWord.toCharArray()
  
              // defines two more pointers, one starting at index [0] and one starting at the last index
              var charPointerOne = 0
              var charPointerTwo = currentWord.length - 1
  
              // while charPointerOne is less than charPointerTwo
              while (charPointerOne &lt; charPointerTwo) {
                  // if the currently selected character by charPointerOne is included in the exclusion characters...
                  if (exclusion.contains(charArray[charPointerOne])) {
                      // move charPointerOne one place forward
                      charPointerOne++
                      // else if the currently selected character by charPointerTwo is included in the exclusion characters...
                  } else if (exclusion.contains(charArray[charPointerTwo])) {
                      // move charPointerTwo one place backwards
                      charPointerTwo--
                      // else, if both conditions are not true, do...
                  } else {
                      // defines the two characters to switch by charPointerOne and charPointerTwo
                      val charToSwitchOne = charArray[charPointerOne]
                      val charToSwitchTwo = charArray[charPointerTwo]
                      // swaps these characters with each other
                      charArray[charPointerOne] = charToSwitchTwo
                      charArray[charPointerTwo] = charToSwitchOne
                      // moves charPointerOne and charPointerTwo one place forward and one place backwards respectively
                      charPointerOne++
                      charPointerTwo--
                  }
              }
  
              val result = String(charArray)
              list.add(result)
              // increase the wordPointer by one so the program moves onto the next word in the string
              wordPointer++
              // assigns each character array to a variable, converted into a string
  
          }
  
          val string = &quot;&quot;
  
          for (i in list) {
              string.plus(i)
          }
  
          return string
      }
  }
  </code></pre>