check for finished activity
This commit is contained in:
parent
573256d7d4
commit
10d5b914f3
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
package info.nightscout.androidaps.plugins.Actions.dialogs;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -153,6 +154,12 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
||||||
result = pump.setTempBasalAbsolute(finalBasal, finalDurationInMinutes);
|
result = pump.setTempBasalAbsolute(finalBasal, finalDurationInMinutes);
|
||||||
}
|
}
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
|
if (context instanceof Activity) {
|
||||||
|
Activity activity = (Activity) context;
|
||||||
|
if (activity.isFinishing()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
builder.setTitle(MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||||
builder.setMessage(result.comment);
|
builder.setMessage(result.comment);
|
||||||
|
|
Loading…
Reference in a new issue