AndroidImageSlider
AndroidImageSlider copied to clipboard
memory leak
I have memory leak just by adding
<com.daimajia.slider.library.SliderLayout
android:id="@+id/slider"
android:layout_width="match_parent"
android:layout_height="200dp"
/>
to view
Any solution ?
Have you guys done the following in your activity or fragment? @d7coders @BackPackerDz
@Override
protected void onStop() {
// To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed
mDemoSlider.stopAutoCycle();
super.onStop();
}
Can you provide some logs?
Yes
On 15 Nov 2016 11:11 a.m., "Eric N" [email protected] wrote:
Have you guys done the following in your activity or fragment? @d7coders https://github.com/d7coders @BackPackerDz https://github.com/BackPackerDz
@Override protected void onStop() { // To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed mDemoSlider.stopAutoCycle(); super.onStop(); }
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/daimajia/AndroidImageSlider/issues/164#issuecomment-260569252, or mute the thread https://github.com/notifications/unsubscribe-auth/AEofasqoLvITHW5h2fxYQyX8DgNgi173ks5q-WIrgaJpZM4GX3Ys .
+1 yes i got this issue. everytime sliding an image, the memory usage increased.
Hi everyone I have same problem, everytime image sliding memory allocation increasing. I solved this issue by clean garbage collection, it seems to work :D
public class MainActivity extends AppCompatActivity
implements
BaseSliderView.OnSliderClickListener, ViewPagerEx.OnPageChangeListener
{
// ......
@Override
public void onPageSelected(int position) {
Runtime.getRuntime().gc();
Log.d("Slider Demo", "Page Changed: " + position);
}
}
Hi, I have two tabs in my activity. I am changing the sliders of sliderview when the tab is changed.
this is my code `
if (AppConstants.TAGNAME.FLOOR_PALN.getValue().contentEquals(planType)) {
slider.removeAllSliders();
for (FloorPlan floorPlan : mFloorPlan) {
TextSliderView textSliderView = new TextSliderView(this);
textSliderView
.description(floorPlan.getTitle())
.image(floorPlan.getFloorImg())
.setScaleType(BaseSliderView.ScaleType.Fit);
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra", floorPlan.getTitle());
slider.addSlider(textSliderView);
}
} else {
slider.removeAllSliders();
TextSliderView textSliderView = new TextSliderView(this);
textSliderView
.description(layout.getTitle())
.image(layout.getMasterImg())
.setScaleType(BaseSliderView.ScaleType.Fit);
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putString("extra", layout.getTitle());
slider.addSlider(textSliderView);
}`
i am comparing the string and removing the sliders, then adding the new sliders of the particular tab. But i am getting out of memory exception for this. Can any one tel me how to solve this?
Have you guys done the following in your activity or fragment? @d7coders @BackPackerDz
@Override protected void onStop() { // To prevent a memory leak on rotation, make sure to call stopAutoCycle() on the slider before activity or fragment is destroyed mDemoSlider.stopAutoCycle(); super.onStop(); }
Can you provide some logs?
you saved my time,thanks