I have to pass an array string adapter from an activity, which is where my bank is loading into a fragment, where I want to put that in a list, but nothing that I try for right. Would anyone have any ideas?
// Banco
try{
database=new DataBase(this);
conn = database.getWritableDatabase();
res = new Repositorio(conn);
res.testeinserir();
// esse adpter recebe a lista vindo do banco
this.adpter = res.ListContas(this);
Toast.makeText(this, "Conexão feita com sucesso!", Toast.LENGTH_SHORT).show();
}
catch(SQLException ex){
Toast.makeText(this,"Erro ao se conectar ao banco!",Toast.LENGTH_SHORT).show();
}
//Aqui é onde mando a lista para o metodo setar lista que ta dentro da Classe Contas, que eu instanciei como adp
Runnable r = new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
if(adp != null){
adp.SetarLista(adpter);
}
}
});
}
};
Thread t = new Thread(r);
t.start();
// Here is where the list is set with adpter, within the class accounts public void SetarList (ArrayAdapter adpter) { this.listAdapter (adpter); }