toast out of memory

This commit is contained in:
Milos Kozak 2017-03-09 22:24:57 +01:00
parent aa46479cdb
commit 48d30f2da3

View file

@ -38,6 +38,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientS
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI;
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService; import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
public class NSClientInternalPlugin implements PluginBase { public class NSClientInternalPlugin implements PluginBase {
private static Logger log = LoggerFactory.getLogger(NSClientInternalPlugin.class); private static Logger log = LoggerFactory.getLogger(NSClientInternalPlugin.class);
@ -189,12 +190,16 @@ public class NSClientInternalPlugin implements PluginBase {
} }
private void updateLog() { private void updateLog() {
Spanned newTextLog = Html.fromHtml(""); try {
for (EventNSClientNewLog log : listLog) { Spanned newTextLog = Html.fromHtml("");
newTextLog = (Spanned) TextUtils.concat(newTextLog, log.toHtml()); for (EventNSClientNewLog log : listLog) {
newTextLog = (Spanned) TextUtils.concat(newTextLog, log.toHtml());
}
textLog = newTextLog;
MainApp.bus().post(new EventNSClientUpdateGUI());
} catch (OutOfMemoryError e) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), "Out of memory!\nStop using this phone !!!");
} }
textLog = newTextLog;
MainApp.bus().post(new EventNSClientUpdateGUI());
} }
public void resend(String reason) { public void resend(String reason) {