Mi activity Verbos2:
EDITO
Agrego la activity Verbos2 como quedó y funcionando:
public class Verbos2 extends AppCompatActivity {
RecyclerView recyclerViewItem;
RecyclerViewAdapter recyclerViewVerbos;
EditText etVerbos;
Button mostrar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.verbos2);
etVerbos = findViewById(R.id.etIngresar);
mostrar = findViewById(R.id.bnMostrar);
recyclerViewItem = findViewById(R.id.rvListItems);
LinearLayoutManager manager = new LinearLayoutManager(this);
recyclerViewItem.setLayoutManager(manager);
mostrar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
List<Items> completeList = new ArrayList<>();
completeList.addAll(mostrarVerbos());
recyclerViewVerbos = new RecyclerViewAdapter((ArrayList<Items>) completeList);
recyclerViewItem.setAdapter(recyclerViewVerbos);
}
});
}
public List<Items> mostrarVerbos(){
BaseDeDatos admin = new BaseDeDatos(getApplicationContext(), "verbos.db", getApplicationContext(), 10);
SQLiteDatabase db = admin.getReadableDatabase();
String[] parametros = {etVerbos.getText().toString()};
Cursor cursor = db.rawQuery("SELECT * FROM verbos WHERE verbos =?", parametros);
List<Items> verbos= new ArrayList<>();
if(cursor.moveToFirst()){
do {
verbos.add(new Items(cursor.getString(1), cursor.getString(2), cursor.getString(3)));
}while (cursor.moveToNext());
}else{
Toast.makeText(getApplicationContext(), "El verbo no existe", Toast.LENGTH_LONG).show();
}
return verbos;
}
}