title: Error in search result Android SQLite
body: <p>I created an app that shows a list of places and i created a search dialog wherein the user will type in edittext so he/she will find the desired place. but i got an error that i will post below.</p>
  
  <blockquote>
    <p>Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference at com.example.ubaldo.myapplication.Place$4$1.onClick(Place.java:221)</p>
  </blockquote>
  
  <p>This is the line 221 in my code</p>
  
  <pre><code>GetSearchPlace = dbhelper.getPlaceSearch(placeLocationEditText.getText().toString());
  </code></pre>
  
  <p>This is my DatabaseHelper</p>
  
  <pre><code>public List&lt;PlaceModel&gt; getPlaceSearch(String location) {
          List&lt;PlaceModel&gt; search = new ArrayList&lt;PlaceModel&gt;();
  
          String selectQuery = "SELECT * FROM listing_place where province_name like '" + location + "'";
          SQLiteDatabase db = this.getReadableDatabase();
          Cursor cursor = db.rawQuery(selectQuery, null);
  
          if (cursor.moveToFirst()) {
              do {
                  PlaceModel pm = new PlaceModel();
                  pm.setlisting_title(cursor.getString(cursor.getColumnIndex(KEY_PLACE)));
                  search.add(pm);
              }
              while (cursor.moveToNext());
          }
          cursor.close();
          return search;
      }
  </code></pre>
  
  <p>This is my main activity</p>
  
  <pre><code> placeLocationEditText = (EditText)findViewById(R.id.placelocation);
  
                  Button button = (Button) dialog.findViewById(R.id.btnplacesearch);
  
                  button.setOnClickListener(new View.OnClickListener() {
                      @Override
                      public void onClick(View v) {
                          dialog.dismiss();
  
                          PlaceListView = findViewById(R.id.placelayout);
                          ViewGroup parent = (ViewGroup) PlaceListView.getParent();
                          parent.removeView(PlaceListView);
                          PlaceSearchView = getLayoutInflater().inflate(R.layout.searchresult_place, parent, false);
                          parent.addView(PlaceSearchView);
  
                          GetSearchPlace = dbhelper.getPlaceSearch(placeLocationEditText.getText().toString());
                          lv2 = (ListView) findViewById(R.id.searchplace_list);
                          lv2.setAdapter(new ViewAdapterSearchPlace());
  </code></pre>