Code example for AutoCompleteTextView

Methods: setAdaptergetText

0
    /** 
     * Generate the password base on the label and master password. 
     */ 
    private void generatePassword(){ 
       
      String label = mLabelText.getText().toString();
      String password = mMasterPasswordText.getText().toString();
      PasswordGenerator generator = new PasswordGenerator(label,password);
      mPasswordText = generator.generate();
       
      updateDb(label);
    } 
     
    /** 
     * Update the SQLite database with the label the user just used. 
     * @param label - A string that represents the label. 
     */ 
    private void updateDb(String label){
      label = label.toLowerCase();
      dbAdapter.addLabel(label);
       
      if (!labels.contains(label))
        labels.add(label);
     
      ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
        android.R.layout.simple_dropdown_item_1line, labels);
      mLabelText.setAdapter(adapter);
    } 
     
    /** 
     * Create a dialog to display the password to the user. 
     */