Well, already fine-tuning the App that I am developing, I find myself in a small dilemma.
Good to the point, I have a screen called customer, I show a list of clients, and in the% share% I have a button which makes me ActionBar
MultiChoice which I must select the areas I will visit .
Up to that point everything is fine, I get all that data from AlertDialog
.
My doubt is that I need when I select an option of my MultiChoice that is saved in the WebServices
and when I tap again on the filter button I show the last thing I had selected.
I leave the code where I generate my SharedPreferences
MultiChoice
protected void onPostExecute(ArrayList arrayList){
super.onPostExecute(arrayList);
final String[] zona = new String[ZonaArrayList.size()];
// zona = ZonaArrayList.toArray(zona);
for(int i=0; i<ZonaArrayList.size(); i++){
//Obtiene el campo Descripción y lo agrega al array de strings "zona".
zona[i] = ZonaArrayList.get(i).getDescripcion();
// zona[i] = ZonaArrayList.get(i).getClave();
}
final boolean[] selCrayons={true,false,true};
AlertDialog.Builder dialog=new AlertDialog.Builder(Clientes.this);
dialog.setTitle("Selecciona la(s) Zonas a Visitar");
dialog.setMultiChoiceItems(zona,selCrayons,new DialogInterface.OnMultiChoiceClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1, boolean arg2) {
// TODO Auto-generated method stub
if(arg2) {
Toast.makeText(getApplicationContext(), "Zona Seleccionada " + zona[arg1],Toast.LENGTH_SHORT).show();
}
}
});
dialog.setPositiveButton("Ok",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
//Mandar a llamar metodo Clientes con el filtro
}
});
dialog.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
AlertDialog alertDialog=dialog.create();
alertDialog.show();
}
}
I clarify the use of the class AlertDialog
for the call of Asynctask
.