diff --git a/src/com/github/nutomic/controldlna/gui/ServerFragment.java b/src/com/github/nutomic/controldlna/gui/ServerFragment.java index 1f41d14..fbe554e 100644 --- a/src/com/github/nutomic/controldlna/gui/ServerFragment.java +++ b/src/com/github/nutomic/controldlna/gui/ServerFragment.java @@ -131,6 +131,8 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene .getDevice(new UDN(mRestoreServer.replace("uuid:", "")), false); if (mCurrentServer != null) { setListAdapter(mFileAdapter); + // Duplicate the top element because getFiles will remove it. + mListState.add(mListState.peek()); getFiles(true); } @@ -196,13 +198,6 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene outState.putParcelableArrayList("list_state", new ArrayList(mListState)); } - @Override - public void onPause() { - super.onPause(); - mListState.pop(); - mListState.push(getListView().onSaveInstanceState()); - } - @Override public void onDestroy() { super.onDestroy(); @@ -266,7 +261,8 @@ public class ServerFragment extends ListFragment implements OnBackPressedListene * Displays the current directory on the ListView. * * @param restoreListState True if we are going back up the directory tree, - * which means we restore scroll position etc. + * which means we restore scroll position etc. This pops + * mListState. */ private void getFiles(final boolean restoreListState) { if (mCurrentServer == null)