mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-30 19:49:59 +02:00
Hold on to OpenScale instance in the Application instance
Hopefully fixes #294.
This commit is contained in:
@@ -21,6 +21,7 @@ import com.health.openscale.BuildConfig;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class Application extends android.app.Application {
|
public class Application extends android.app.Application {
|
||||||
|
OpenScale openScale;
|
||||||
|
|
||||||
private class TimberLogAdapter extends Timber.DebugTree {
|
private class TimberLogAdapter extends Timber.DebugTree {
|
||||||
@Override
|
@Override
|
||||||
@@ -40,5 +41,8 @@ public class Application extends android.app.Application {
|
|||||||
|
|
||||||
// Create OpenScale instance
|
// Create OpenScale instance
|
||||||
OpenScale.createInstance(getApplicationContext());
|
OpenScale.createInstance(getApplicationContext());
|
||||||
|
|
||||||
|
// Hold on to the instance for as long as the application exists
|
||||||
|
openScale = OpenScale.getInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user