title: Search Arabic custom listview
body: <p>I have a custom listview which has Arabic strings.I want to search for a specific view (row) in that listview .I use addTextChangedListener in my main activity like below</p>
  
  <pre><code> editsearch = (EditText) findViewById(R.id.search);
          editsearch.addTextChangedListener(new TextWatcher() {
  
              @Override
              public void afterTextChanged(Editable arg0) {
                  // TODO Auto-generated method stub
                  String text = editsearch.getText().toString().toLowerCase(Locale.ENGLISH.getDefault());
                  //String text = editsearch.getText().toString();
                  adapter.filter(text);
              }
  
             @Override
              public void beforeTextChanged(CharSequence arg0, int arg1,int arg2, int arg3) {
                  // TODO Auto-generated method stub
              }
  
              @Override
              public void onTextChanged(CharSequence arg0, int arg1, int arg2,int arg3) {
                  // TODO Auto-generated method stub
              }
          });
  </code></pre>
  
  <p>In my adpater ,I use base adapter</p>
  
  <pre><code>   Context mContext;
      LayoutInflater inflater;
      private List&lt;MyDataModelads2&gt; modelList = null;
      private ArrayList&lt;MyDataModelads2&gt; arraylist;
  
  
  
      public myarraynew(Context context, List&lt;MyDataModelads2&gt; modelList) {
          mContext = context;
          this.modelList = modelList;
          inflater = LayoutInflater.from(mContext);
          this.arraylist = new ArrayList&lt;MyDataModelads2&gt;();
          this.arraylist.addAll(modelList);
  
      }
  </code></pre>
  
  <p>and I inserted the following filter method in my adapter</p>
  
  <pre><code> public void filter(String charText) {
          charText = charText.toLowerCase(Locale.getDefault());
          modelList.clear();
          if (charText.length() == 0) {
              modelList.addAll(arraylist);
          } else {
              for (MyDataModelads2 wp : arraylist) {
                  if (wp.getName().toLowerCase(Locale.getDefault()).contains(charText)) {
                      modelList.add(wp);
                  }
              }
          }
          notifyDataSetChanged();
      }
  </code></pre>
  
  <p>There's two problems:</p>
  
  <ol>
  <li>When I type a text in search bar , The list becomes empty even if I
  remove the text I typed (empty search bar).In other words, the list
  turns empty after I type any text in search bar and after I remove
  that text.</li>
  <li>What should I add to my code to enable searching for Arabic language
  ? as I think the code is for English only</li>
  </ol>