title: No searching results after onTextChanged in android Listview
body: <p>I can't resolve this problem. I want to add search functionality by EditText. Results should dynamically display after typing letters but now there is no results.</p>
  
  <p>Thanks for Your quick response :)</p>
  
  <p><b>ParkingActivity.java</b></p>
  
  <pre><code>public class ParkingActivity extends FragmentActivity {
  
  private final String URL_TO_HIT = "http://www-users.mat.umk.pl/~discordia/dane.json";
  private ListView lvParking;
  private EditText inputSearch;
  public ParkingAdapter adapter;
  public ArrayList&lt;ParkingModel&gt; parkingModelList = new ArrayList();
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.list_activity);
  
      lvParking = (ListView) findViewById(R.id.lvParking);
      inputSearch = (EditText) findViewById(R.id.editText);
      new JSONTask().execute(URL_TO_HIT);
  
  }
  
  
  public class JSONTask extends AsyncTask&lt;String,String, List&lt;ParkingModel&gt; &gt; {
  
      @Override
      protected void onPreExecute() {
          super.onPreExecute();
      }
  
      @Override
      protected List&lt;ParkingModel&gt; doInBackground(String... params) {
          HttpURLConnection connection = null;
          BufferedReader reader = null;
  
          try {
              URL url = new URL(params[0]);
              connection = (HttpURLConnection) url.openConnection();
              connection.connect();
              InputStream stream = connection.getInputStream();
              reader = new BufferedReader(new InputStreamReader(stream));
              StringBuffer buffer = new StringBuffer();
              String line ="";
              while ((line = reader.readLine()) != null){
                  buffer.append(line);
              }
  
              String finalJson = buffer.toString();
  
              JSONObject parentObject = new JSONObject(finalJson);
              JSONArray parentArray = parentObject.getJSONArray("parkingInfo");
  
              ArrayList&lt;ParkingModel&gt; parkingModelList = new ArrayList&lt;&gt;();
  
              Gson gson = new Gson();
              for(int i=0; i&lt;parentArray.length(); i++) {
                  JSONObject finalObject = parentArray.getJSONObject(i);
                  /**
                   * below single line of code from Gson saves you from writing the json parsing yourself which is commented below
                   */
                  ParkingModel parkingModel = gson.fromJson(finalObject.toString(), ParkingModel.class);
  
                  parkingModelList.add(parkingModel);
  
              }
              return parkingModelList;
  
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } catch (JSONException e) {
              e.printStackTrace();
          } finally {
              if(connection != null) {
                  connection.disconnect();
              }
              try {
                  if(reader != null) {
                      reader.close();
                  }
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
          return  null;
      }
  
      @Override
      protected void onPostExecute(final List&lt;ParkingModel&gt; result) {
          super.onPostExecute(result);
  
          if(result != null) {
              adapter = new ParkingAdapter(getApplicationContext(), R.layout.row, result);
              lvParking.setAdapter(adapter);
              inputSearch.addTextChangedListener(new TextWatcher() {
  
                  @Override
                  public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
                      // When user changed the Text
                      ParkingActivity.this.adapter.getFilter().filter(cs);
                  }
  
                  @Override
                  public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                                                int arg3) {
                      // TODO Auto-generated method stub
  
                  }
  
                  @Override
                  public void afterTextChanged(Editable arg0) {
                      // TODO Auto-generated method stub
                  }
              });
              lvParking.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      ParkingModel parkingModel = result.get(position);
                      Intent intent = new Intent(ParkingActivity.this, DetailActivity.class);
                      intent.putExtra("parkingModel", new Gson().toJson(parkingModel));
                      startActivity(intent);
                  }
              });
  
          }
      }
  
  }
  
  public class ParkingAdapter extends ArrayAdapter {
  
      private List&lt;ParkingModel&gt; parkingModelList;
      private int resource;
      private LayoutInflater inflater;
      public ParkingAdapter(Context context, int resource, List&lt;ParkingModel&gt; objects) {
          super(context, resource, objects);
          parkingModelList = objects;
          this.resource = resource;
          inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
  
          ViewHolder holder = null;
  
          if(convertView == null){
              holder = new ViewHolder();
              convertView = inflater.inflate(resource, null);
              holder.tvLokalizacja = (TextView)convertView.findViewById(R.id.tvLokalizacja);
              holder.tvIle_wolnych_zwyklych = (TextView)convertView.findViewById(R.id.tvIle_wolnych_zwyklych);
              holder.tvIle_wszystkich_zwyklych = (TextView)convertView.findViewById(R.id.tvIle_wszystkich_zwyklych);
              convertView.setTag(holder);
          } else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          holder.tvLokalizacja.setText(parkingModelList.get(position).getLokalizacja());
          holder.tvIle_wolnych_zwyklych.setText("Wolne: " + parkingModelList.get(position).getIle_wolnych_zwyklych());
          holder.tvIle_wszystkich_zwyklych.setText("Wszystkie:" + parkingModelList.get(position).getIle_wszystkich_zwyklych());
  
  
          return convertView;
      }
  
  
      class ViewHolder{
  
          private TextView tvLokalizacja;
          private TextView tvIle_wolnych_zwyklych;
          private TextView tvIle_wszystkich_zwyklych;
  
      }
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.menu_parking, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
  
      return super.onOptionsItemSelected(item);
  }
  }
  </code></pre>
  
  <p>This is my model which I use to create final array with data.</p>
  
  <p><b>ParkingModel.java</b></p>
  
  <pre><code>public class ParkingModel {
  
  private String lokalizacja;
  private int ile_wolnych_zwyklych;
  private int ile_wszystkich_zwyklych;
  
  public String getLokalizacja() {
      return lokalizacja;
  }
  
  public void setLokalizacja(String lokalizacja) {
      this.lokalizacja = lokalizacja;
  }
  
  public int getIle_wolnych_zwyklych() {
      return ile_wolnych_zwyklych;
  }
  
  public void setIle_wolnych_zwyklych(int ile_wolnych_zwyklych) {
      this.ile_wolnych_zwyklych = ile_wolnych_zwyklych;
  }
  
  public int getIle_wszystkich_zwyklych() {
      return ile_wszystkich_zwyklych;
  }
  
  public void setIle_wszystkich_zwyklych(int ile_wszystkich_zwyklych) {
      this.ile_wszystkich_zwyklych = ile_wszystkich_zwyklych;
  }
  }
  </code></pre>
  
  <p>Here is my xml file.</p>
  
  <p><b>list_activity.xml</b></p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical"
  tools:context=".ParkingActivity"&gt;
  
  
  &lt;EditText
      android:layout_width="319dp"
      android:layout_height="wrap_content"
      android:id="@+id/editText"
      android:inputType="text"
      android:layout_gravity="center_horizontal" /&gt;
  
  &lt;ListView
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/lvParking" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>