I have a problem with my app. What I'm trying to do is to find rhymes to a word entered from the user into a text field. I have a dictionary in assets folder called "words.txt". My app is working almost correctly, but it finds only one word from my text file. How can I find all words that rhyme with the word from the text field? Any ideas? Here is my code:
@Override
protected void onCreate(Bundle saveInstanceState){
    super.onCreate(saveInstanceState);
    setContentView(R.layout.activity_main);
    editTextWord = (EditText)findViewById(R.id.editTextWord);
    b_read = (Button)findViewById(R.id.buttonSearch);
    tv_text = (TextView)findViewById(R.id.nameTxt);
    b_clear = (Button)findViewById(R.id.buttonClear);
    b_clear.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent i = new Intent(MainActivity.this, MainActivity.class);
            startActivity(i);
        }
    });
    b_read.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                InputStream is = getAssets().open("words.txt");
                int size = is.available();
                BufferedReader rd = new BufferedReader(new InputStreamReader(is,"UTF-8"));
                String line;
                String word = editTextWord.getText().toString();
                if (word.isEmpty()){
                    Toast.makeText(getApplicationContext(), "Wpisz słowo", Toast.LENGTH_SHORT).show();
                    return;
                }
                while ((line = rd.readLine()) !=null ){
                    if (line.substring(line.length()-2).equals(word.substring(word.length()-2))){
                        tv_text.setText(line);
                    }
                }
                rd.close();
            }catch (IOException ex){
                ex.printStackTrace();
            }
        }
    });
}
 
    