Loop through the cursor to read each element (Here I am considering it to be a list). If the trigger condition is met, set boolean WAITING to true, call showDialog() and finally call a waiting loop. This waiting loop will ensure that the parent for loop waits untill the user responds to the inflated dialog from the showDialog().
for(int count =0 ; count<100 ; count ++)
{
if(List.get(count).ID != InputValue)
{
WAITING=true;
showDialog(List.get(count).ID , InputValue);
while(WAITING);
}
}
In showDialog() first create the Dialog and setCancelable() to false so that user has to click on one of the three buttons(append, overwrite or skip) to disable the dialog. Then handle click events for these three, do the required DB operation and finally set WAITING=false and Hide the dialog. This will resume the parent for loop.
showDialog(String DB_Value, Input)
{
Show Dialog with option Buttons and Set dialog.setCancelable(false);
On click of any of one of the three buttons(append, overwrite or skip)
1. do the required DB action
2. hide the dialog
3. WAITING= false
}
Hope this helps you!