title: Text Watcher JSONObject in ListView
body: <p>I tried to make AutoComplete Search for my app, but my code filtered titles of books and showed wrong items in my ListView. It doesn't make senses. For example, when I typed 'M' in EditText, it showed others list these aren't start alphabet with 'M' or without 'M' in title names of books. Help me please?</p>
  
  <p>This is my adapter that I extended ArrayAdapter.</p>
  
  <pre><code>public class CustomList extends ArrayAdapter&lt;String&gt; {
      private String[] titles;
      private String[] authors;
      private String[] prices;
      private String[] pricebycovers;
      private String[] percentdiscounts;
      private String[] urls;
      private Bitmap[] bitmaps;
      private Activity context;
  
  
      public CustomList(Activity context, String[] titles, String[] authors, String[] prices, String[] pricebycovers, String[] percentdiscounts, String[] urls, Bitmap[] bitmaps) {
          //super(context, R.layout.list_view, urls);
          //super(context, R.layout.list_view, titles);
          super(context, R.layout.list_view, R.id.editTextTitle, titles);
          this.context = context;
          this.titles = titles;
          this.authors = authors;
          this.prices = prices;
          this.pricebycovers = pricebycovers;
          this.percentdiscounts = percentdiscounts;
          this.urls= urls;
          this.bitmaps= bitmaps;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = context.getLayoutInflater();
          View listViewItem = inflater.inflate(R.layout.list_view, null, true);
          TextView tvTitle = (TextView) listViewItem.findViewById(R.id.tvTitle);
          TextView tvAuthor = (TextView) listViewItem.findViewById(R.id.tvAuthor);
          TextView tvPrice = (TextView) listViewItem.findViewById(R.id.tvPrice);
          TextView tvPriceByCover = (TextView) listViewItem.findViewById(R.id.tvPriceByCover);
          TextView tvPercentageDiscount = (TextView) listViewItem.findViewById(R.id.tvPercentageDiscount);
          ImageView imvBookPic = (ImageView) listViewItem.findViewById(R.id.imvBookPic);
  
          tvTitle.setText(titles[position]);
          tvAuthor.setText(authors[position]);
          tvPrice.setText(prices[position]);
          tvPriceByCover.setText(pricebycovers[position]);
          tvPercentageDiscount.setText(percentdiscounts[position]);
  
          imvBookPic.setImageBitmap(Bitmap.createScaledBitmap(bitmaps[position],80,80,false));
          return listViewItem;
      }
  
      public String[] getTitle(){
          return titles;
      }
  }
  </code></pre>
  
  <p>And this is a part of MainActivity that I called TextWatcher</p>
  
  <pre><code>private ListView listView;
  private CustomList customList;
  private CustomList customList;
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_profile);
  
      listView = (ListView) findViewById(R.id.listView);
      listView.setOnItemClickListener(this);
  
      /**
       * Enabling Search Filter
       * */
      inputSearch = (EditText) findViewById(R.id.inputSearch);
  
      inputSearch.addTextChangedListener(new TextWatcher() {
  
          @Override
          public void onTextChanged(CharSequence cs, int arg1, int arg2, int arg3) {
              // When user changed the Text
              MainActivity.this.customList.getFilter().filter(cs);
              //Log.w("d",this.customList.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
  
          }
      });
  }
  </code></pre>
  
  <p>I called and setAdapter like this</p>
  
  <pre><code>customList = new CustomList(MainActivity.this, GetAlIBooks.titles, GetAlIBooks.authors, GetAlIBooks.prices, GetAlIBooks.pricebycovers, GetAlIBooks.percentdiscounts, GetAlIBooks.imageURLs, GetAlIBooks.bitmaps);
  listView.setAdapter(customList);
  </code></pre>
  
  <p>This is my ListView Layout in XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
  
      &lt;ImageView
          android:id="@+id/imvBookPic"
          android:layout_width="80dp"
          android:layout_height="80dp"
          android:layout_column="0"
          android:layout_marginRight="10dp"
          android:layout_row="0"
          android:layout_rowSpan="4"
          android:background="@drawable/book_default" /&gt;
  
      &lt;TextView
          android:id="@+id/tvTitle"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_column="1"
          android:layout_columnSpan="2"
          android:layout_columnWeight="1"
          android:layout_row="0"
          android:text="Title"
          android:textStyle="bold" /&gt;
  
  
      &lt;TextView
          android:id="@+id/tvAuthor"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_column="1"
          android:layout_columnSpan="2"
          android:layout_columnWeight="1"
          android:layout_row="1"
          android:layout_weight="1"
          android:text="Author"
          android:textSize="12sp" /&gt;
  
      &lt;TextView
          android:id="@+id/tvPrice"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_column="1"
          android:layout_columnWeight="1"
          android:layout_marginRight="5dp"
          android:layout_row="2"
          android:text="Price"
          android:textColor="@color/red" /&gt;
  
      &lt;TextView
          android:id="@+id/tvPriceByCover"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_column="2"
          android:layout_columnWeight="1"
          android:layout_row="2"
          android:text="Price by cover" /&gt;
  
      &lt;TextView
          android:id="@+id/tvPercentageDiscount"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_column="1"
          android:layout_columnSpan="2"
          android:layout_columnWeight="1"
          android:layout_row="3"
          android:text="Percentage Discount"
          android:textColor="@color/green" /&gt;
  
  
  &lt;/GridLayout&gt;
  </code></pre>