0

I overrided the method showDialog(int) like this:

@Override
public Dialog onCreateDialog(int id ){
    Log.d("Dialog",id+":created");
    switch (id) {
    case addressValidateProgressId:
        addressValidateProgress = new AddressValidateProgress(this);
        return addressValidateProgress;
    case gpsSearchloadId:
        gpsSearchload = new GPSSearchProgress(this,geocodeLocationToAddress);
        return gpsSearchload;
    case alertId:
        prepareAddressChooseDialog(addressList);
        return addressChooseDialog;
    default:
        return null;
    }

}

This works fine, the dialog displays and change orientation with the screen.

The problem is, if i rotate the screen when i call dismissDialog(id) i get an exception saying that "java.lang.IllegalArgumentException: no dialog with id 0 was ever shown via Activity#showDialog".

The showDialog method shouldn't make the activity the owner of dialogs?

I can't see what is possible wrong.

Thanks.

Hugo Alves
  • 188
  • 1
  • 10
  • How about showing us the rest of your code related to showing the dialog? Where are you defining your dialog IDs? – Aaron Klotz Jul 13 '12 at 01:53
  • The code that show the dialog `private void showDialog(Class> classs) { if(classs.equals(AddressValidateProgress.class)){ showDialog(addressValidateProgressId); }if(classs.equals(GPSSearchProgress.class)){ showDialog(gpsSearchloadId); } }` The handler is static and the id's are static ints too. – Hugo Alves Jul 13 '12 at 18:20

0 Answers0