title: How to query Room database for LiveData<String> while passing a variable
body: <p>When I hard code the variable the query works:</p>
  <p>From the Dao:</p>
  <pre><code>@Query(&quot;SELECT amount FROM note_table WHERE item = 'Apple'&quot;)
      LiveData&lt;String&gt; getAmount();
  </code></pre>
  <p>but when I try to pass a variable it doesn't.</p>
  <pre><code> @Query(&quot;SELECT amount FROM note_table WHERE item = :items&quot;)
      LiveData&lt;String&gt; getAmountwithItem(String items);
  </code></pre>
  <p>From the ViewModel:</p>
  <pre><code>private final LiveData&lt;String&gt; NoteAmount, NoteAmountwithItem;
  
  NoteAmount = repository.getAmount();
  NoteAmountwithItem = repository.getNoteAmountwithItem();
  
   LiveData&lt;String&gt; getAmount() {
          return NoteAmount;
      }
  
   LiveData&lt;String&gt; getNoteAmountwithItem() {
          return NoteAmountwithItem;
      }
  </code></pre>
  <p>From the Repository:</p>
  <pre><code>private final LiveData&lt;String&gt; NoteAmount, NoteAmountwithItem;
  
  NoteAmount = noteDao.getAmount();
  NoteAmountwithItem = noteDao.getAmountwithItem();
  
  LiveData&lt;String&gt; getAmount() {
          return NoteAmount;
      }
  
  LiveData&lt;String&gt; getNoteAmountwithItem() {
          return NoteAmountwithItem;
      }
  </code></pre>
  <p>From MainActivity.java</p>
  <pre><code>noteViewModel.getAmount().observe(this, new Observer&lt;String&gt;() {
              @Override
              public void onChanged(@Nullable String queryAmount) {
                  if(queryAmount != null){
                      updateamount = String.valueOf(Integer.parseInt(queryAmount) + 1);
                      testTextView.setText(&quot;Amount: &quot; + updateamount);
                  }else{
                      updateamount = &quot;1&quot;;
                  }
              }
          });
  </code></pre>
  <p>This gives me the amount of Apples in queryAmount but I have different fruits and want to pass the fruit as a variable and get the amount of specific fruits.</p>