You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Like many java libraries that utilize static singletons, the best way to integrate them into Android is to create an Application class and initialize in Application.onCreate OR to create a subclass of Activity which initializes the library in onCreate with a static boolean flag that prevents additional initialization then have all of your Activities extend this 'BaseActivity'.
If you want to test that you've fixed this problem, you can do so by minimizing your application when attached to DDMS, killing your process with the stop button in the eclipse ddms (or kill -9 via adb shell), and then switching back to your activity, this will cause your application to be created in a new process which will not retain your static vars.
Hi, Am facing an issue ,
06-13 14:31:09.890 4566-4566/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.demo.eyeandbuy, PID: 4566
java.lang.RuntimeException: ImageLoader must be init with configuration before using
at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:168)
at com.demo.eyeandbuy.ViewProducts$ImagePagerAdapter.instantiateItem(ViewProducts.java:319)
at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837)
at android.support.v4.view.ViewPager.populate(ViewPager.java:987)
at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:742)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:607)
at android.view.View.measure(View.java:16834)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:824)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:500)
at android.view.View.measure(View.java:16834)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1237)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at android.widget.ScrollView.onMeasure(ScrollView.java:326)
at android.view.View.measure(View.java:16834)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:824)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:500)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2368)
at android.view.View.measure(View.java:16834)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2246)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1312)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1509)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1189)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6223)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Activity
westlinkin commentedon Feb 25, 2013
here is the log:
nostra13 commentedon Feb 25, 2013
It happens when you go back from long time app background, right?
westlinkin commentedon Feb 26, 2013
yeah, is there a way to fix this?
nostra13 commentedon Feb 28, 2013
Yes, init ImageLoader in every
Activity.onCreate()
.You can check whether ImageLoader is inited by
imageLoader.isInited()
doapp-nick commentedon Feb 28, 2013
Like many java libraries that utilize static singletons, the best way to integrate them into Android is to create an Application class and initialize in Application.onCreate OR to create a subclass of Activity which initializes the library in onCreate with a static boolean flag that prevents additional initialization then have all of your Activities extend this 'BaseActivity'.
If you want to test that you've fixed this problem, you can do so by minimizing your application when attached to DDMS, killing your process with the stop button in the eclipse ddms (or kill -9 via adb shell), and then switching back to your activity, this will cause your application to be created in a new process which will not retain your static vars.
westlinkin commentedon Mar 1, 2013
big thanks to @doapp-nick and @nostra13 , this is solved.
kiran-path commentedon Jun 13, 2015
Hi, Am facing an issue ,
06-13 14:31:09.890 4566-4566/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.demo.eyeandbuy, PID: 4566
java.lang.RuntimeException: ImageLoader must be init with configuration before using
at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:168)
at com.demo.eyeandbuy.ViewProducts$ImagePagerAdapter.instantiateItem(ViewProducts.java:319)
at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110)
at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837)
at android.support.v4.view.ViewPager.populate(ViewPager.java:987)
at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:742)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:607)
at android.view.View.measure(View.java:16834)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:824)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:500)
at android.view.View.measure(View.java:16834)
at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1237)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at android.widget.ScrollView.onMeasure(ScrollView.java:326)
at android.view.View.measure(View.java:16834)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:824)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:500)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at com.android.internal.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:327)
at android.view.View.measure(View.java:16834)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:340)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2368)
at android.view.View.measure(View.java:16834)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2246)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1312)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1509)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1189)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6223)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5333)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)