Fragments keep going back to the default position when MapView is Zoomed In/Out
Posted
by
hectichavana
on Stack Overflow
See other posts from Stack Overflow
or by hectichavana
Published on 2012-07-04T13:55:00Z
Indexed on
2012/07/07
9:16 UTC
Read the original article
Hit count: 285
android
I have an activity with 3 fragments displayed, a MapActivity, a ListActivity, and a (normal) DetailsActivity. The ListActivity and DetailsActivity is placed over the MapActivity.
There's a function to hide both ListActivity and DetailsActivity with an Animation, and onAnimationEnd() I set a new layout for the hidden Activity.
The problem I'm facing is, everytime one of the ListActivity or DetailsActivity hidden (picture State 2), and then I pinch the screen on the MapActivity to zoom the map, it always goes back to the default view (picture State 1). The closed Activities are automatically opened again.
Does anybody know how to prevent the hidden fragments from going to the first state again when I pinch the MapActivity?
this is an example of the function how I hide the DetailsActivity():
public void hideDetailview() {
final Animation close = AnimationUtils.loadAnimation(this, R.anim.close);
close.setFillEnabled(true);
close.setAnimationListener(closeDetailAnimationListener);
fragment_detail.startAnimation(close);
Toast.makeText(MainFragmentActivity.this,WWHApplication.getDrawer(), Toast.LENGTH_SHORT).show();
}
private AnimationListener closeDetailAnimationListener = new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
int newLeft = -330;
fragment_detail.layout(newLeft,
fragment_detail.getTop(),
newLeft + fragment_detail.getMeasuredWidth(),
fragment_detail.getTop() + fragment_detail.getMeasuredHeight());
}
};


© Stack Overflow or respective owner