i'm newby in Android and I want to give the user a more professional look and feel.
I have a process that export data to Excel file, but it takes too much time.
I trigger the method like this:
...
// TODO Auto-generated method stub
System.out.println(confirm);
if (confirm){
new Thread(new Runnable() {
@Override
public void run() {
ensayoController.exportarEnsayoExcel(list); //<- this takes from 2 to 3 minutes!
for (Ensayo e: list){
Toast.makeText(ExportaEnsayosActivity.this, "Ensayo " + e.getDescripcion() + " exportado!", Toast.LENGTH_LONG);
System.out.println("Ensayo " + e.getDescripcion() + " exportado!");
}
AlertDialog alertDialog = new AlertDialog.Builder(ExportaEnsayosActivity.this).create();
alertDialog.setTitle("Atencion!");
alertDialog.setMessage("Finalizó la exportacion!");
alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
alertDialog.show();
}
}).run();
}
...
I added a message at the end to let the user knows when the task is finished.
I have 2 problems; 1) Toast never shows a message. 2) I want to create and update a progress bar from within "exportarEnsayoExcel" method.
Do I have to add a new parameter with the progressBar UI Element ?
Or the approach is different.
Best Regards