0
I have This class:
abstract public class ListaEstaticaDeErros {
private static ArrayList<DescritorDeErro> listErros = new ArrayList<DescritorDeErro>();
private static boolean fimSinc = false;
private static int municipio = 0;
public static boolean getFimSinc(){
return fimSinc;
}
public static int getMunicipio(){
return municipio;
}
public static void setMunicipio(int i){
municipio = i;
}
public static void setFimSinc(boolean b){
fimSinc = b;
}
public static void setListErros(ArrayList<DescritorDeErro> list){
listErros = list;
}
public static void addRegListErros(DescritorDeErro obj){
listErros.add(obj);
}
public static ArrayList<DescritorDeErro> getListErros(){
return listErros;
}
}
Activity function that I try to recover and show the list size:
public void montarResultados(){
Log.e("Teste-esus", String.valueOf(ListaEstaticaDeErros.getListErros().size()));
Bundle bundle = getIntent().getExtras();
ArrayList<DescritorDeErro> lst = bundle.getParcelableArrayList("lista");
int mun = bundle.getInt("municipio");
String usuario = bundle.getString("usuario");
if(lst.size() > 0) {
new ChargeList().execute(lst, mun, usuario);
}else{
txtVInfo.setText("Nenhum erro capturado ate este momento de sincronização.");
}
if(bundle.getBoolean("fim_sinc")) {
txtEmail.setVisibility(View.VISIBLE);
}else{
txtEmail.setVisibility(View.INVISIBLE);
}
}
And inside an Activity I need to recover this listErros and it always returns me 0, ie without any element, but if I catch her in another class that is not an Activity I can without problems, then the solution I made was to pick her up in another class and send via Intent to the Activity I need, however I would like to take her directly from Activity to be able to implement what I need.
You can add the Activity code that accesses the list?
– Leonardo Lima
I added the function
– João Carlos