title: android studio cannot find a parameter
body: <p>I have an Android app that uses Firebase and I am having an error with a query.</p>
  
  <p>In my class file I am defining the search and I am getting:</p>
  
  <blockquote>
    <p>error: cannot find symbol variable query</p>
  </blockquote>
  
  <p>Here is the code from my class file:</p>
  
  <pre><code>public class SearchFragment extends Fragment {
  
      private static final String TAG = "SearchFragment";
      private static final int NUM_GRID_COLUMNS = 3;
      private static final int GRID_ITEM_MARGIN = 5;
  
      //widgets
      private ImageView mSearchButton;
      private EditText mTitleET;
      private FrameLayout mFrameLayout;
  
  
      //vars
      private String mElasticSearchPassword;
      private String mPrefCity;
      private String mPrefStateProv;
      private String mPrefCountry;
      private ArrayList&lt;Post&gt; mPosts;
      private RecyclerView mRecyclerView;
      private PostListAdapter mAdapter;
      private String queryText;
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
          //View view = inflater.inflate(R.layout.fragment_search, container, false);
          View view = inflater.inflate(R.layout.fragment_search2, container, false);
          //mFilters = (ImageView) view.findViewById(R.id.ic_search);
          mSearchButton = (ImageView) view.findViewById(R.id.search_button);
          mTitleET = (EditText) view.findViewById(R.id.input_title);
          //mSearchText = (EditText) view.findViewById(R.id.input_search);
          mRecyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
          mFrameLayout = (FrameLayout) view.findViewById(R.id.container);
  
          return view;
      }
  
      @Override
      public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
          final DatabaseReference reference = FirebaseDatabase.getInstance().getReference();
  
  
          mSearchButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  
  
                  Query query = reference.child("posts/").orderByChild("title").equalTo(mTitleET.getText().toString().trim()).
                          query.addListenerForSingleValueEvent(new ValueEventListener()
                  {
                      @Override
                      public void onDataChange(DataSnapshot dataSnapshot) {
                          if (dataSnapshot.exists()) {
                              // dataSnapshot is the "issue" node with all children with id 0
                              for (DataSnapshot ds : dataSnapshot.getChildren()) {
                                  // do something with the individual "issues"
                                  Log.i("TAG", ds.getValue().toString());
                              }
                          }
                      }
  
                      @Override
                      public void onCancelled(DatabaseError databaseError) {
                          Log.i("ERRRRRROORRR", databaseError.getMessage() + ", so....let´s take a coffee");
  
                      }
                  });
  
              }
          });    
      }
  
      private void setupPostsList(){
          RecyclerViewMargin itemDecorator = new RecyclerViewMargin(GRID_ITEM_MARGIN, NUM_GRID_COLUMNS);
          mRecyclerView.addItemDecoration(itemDecorator);
          GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), NUM_GRID_COLUMNS);
          mRecyclerView.setLayoutManager(gridLayoutManager);
          mAdapter = new PostListAdapter(getActivity(), mPosts);
          mRecyclerView.setAdapter(mAdapter);
      }
  
  
  }
  </code></pre>
  
  <p>It is specifically the following line(s) that appear to be the problem (see attached pic):
  <a href="https://i.stack.imgur.com/SeJHi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SeJHi.png" alt="enter image description here"></a>
  What is causing this error and what is the solution for this error?</p>