Skip to content

Commit

Permalink
Merge pull request daimajia#104 from massimobio/master
Browse files Browse the repository at this point in the history
Fix demo to prevent memory leak on device orientation change fix daimajia#41
  • Loading branch information
daimajia committed May 9, 2015
2 parents 28bf41e + 7a9cb5a commit 323a43f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions demo/src/main/java/com/daimajia/slider/demo/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ public void onItemClick(AdapterView<?> parent, View view, int position, long id)

}

@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();
}

@Override
public void onSliderClick(BaseSliderView slider) {
Toast.makeText(this,slider.getBundle().get("extra") + "",Toast.LENGTH_SHORT).show();
Expand Down

0 comments on commit 323a43f

Please sign in to comment.