title: getting list of previously entered strings under the edit-text in android "just like a username field of some email/website"
body: <p>I want some directions. I have not much clear understanding about it. So please... </p>
  
  <ol>
  <li><p>Here is my edit-text in xml form:</p>
  
  <pre><code> &lt;EditText 
      android:id="@+id/editTextName"
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:layout_margin="3dp" 
      android:hint="Insert Name"  
      android:onClick="surNameEditTextClick" /&gt;
  </code></pre></li>
  <li><p>Code to get the input-string of the edit-text:</p>
  
  <pre><code>EditText nameText = (EditText) findViewById(R.id.editTextName);
  String name = nameText.getText().toString();
  </code></pre></li>
  <li><p>Saving the name string into an array-list of string:</p>
  
  <pre><code>ArrayList&lt;String&gt; nameArrayList = new ArrayList&lt;String&gt; ; //created globally 
  if(!(nameArrayList.contains(name))){
  
      //Adding input string into the name array-list
      nameArrayList.add(name) ;
  }
  </code></pre></li>
  <li><p>Putting this array-list into the shared-preferences:</p>
  
  <pre><code>SharedPreferences saveGlobalVariables = getSharedPreferences(APP_NAME, 0);
  SharedPreferences.Editor editor = saveGlobalVariables.edit();
  editor.putStringSet("name", new HashSet&lt;String&gt;(surNameArrayList));
  editor.commit();
  </code></pre></li>
  <li><p>Getting all Shared-Preferences data back to array-list when program
  loads (in onCreate() ):</p>
  
  <pre><code>SharedPreferences loadGlobalVariables = getSharedPreferences(APP_NAME, 0);
  nameArrayList = new ArrayList&lt;String&gt;(loadGlobalVariables.getStringSet("name", new HashSet&lt;String&gt;()));
  </code></pre></li>
  </ol>
  
  <p>Now how to get this data in some view form under that edit-text. I have seen different methods but not understanding clearly. If  I use the </p>
  
  <pre><code>EditText mNameEditText;
  mNameEditText = (EditText)findViewById(R.id.editTextName);
  mNameEditText.addTextChangedListener(new TextWatcher() {
  public void afterTextChanged(Editable s){
  
  }
  
  public void beforeTextChanged(CharSequence s, int start, int count, int after){
  
  }
  
  public void onTextChanged(CharSequence s, int start, int before, int count){
  
  }
  </code></pre>
  
  <p>});</p>
  
  <p>Then what code snipet will be used here? Which textView or list-view should be used and where???
  I am unable to understand it.
  If any other method is available, then please provide here.
  regards,</p>