title: How to use setters and getters in different java file
body: <p>This is my setters and getters in ShoppingListName.java</p>
  
  <pre><code>public class ShoppingListName {
      private String shoppingListName;
  
      public String getShoppingListName() {
          return shoppingListName;
      }
  
      public void setShoppingListName(String shoppingListName) {
          this.shoppingListName = shoppingListName;
      }
  }
  </code></pre>
  
  <p>I did this in MainMenu.java</p>
  
  <pre><code>ShoppingListName shoppingList = new ShoppingListName();
  shoppingList.setShoppingListName(inputListName.getText().toString());
  </code></pre>
  
  <p>And I'm trying to pass the string to a different java file (CreateList.java)
  How can I do that?</p>
  
  <p>I tried this.</p>
  
  <pre><code>ShoppingListName shoppingList = new ShoppingListName();
  Log.e("ShoppingListName", "" + shoppingList.getShoppingListName());
  </code></pre>
  
  <p>But obvious I'm receiving a null return.</p>