Do not crash multiple uploads screen on screen rotate

This commit is contained in:
YuviPanda 2013-03-17 03:59:04 +05:30
parent 154a559b86
commit 0fe1ef73e5

View file

@ -111,6 +111,10 @@ public class MultipleUploadListFragment extends SherlockFragment {
photosGrid = (GridView)view.findViewById(R.id.multipleShareBackground); photosGrid = (GridView)view.findViewById(R.id.multipleShareBackground);
baseTitle = (EditText)view.findViewById(R.id.multipleBaseTitle); baseTitle = (EditText)view.findViewById(R.id.multipleBaseTitle);
if(savedInstanceState != null) {
setData(savedInstanceState.<Contribution>getParcelableArrayList("photosData"));
}
baseTitle.addTextChangedListener(new TextWatcher() { baseTitle.addTextChangedListener(new TextWatcher() {
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
@ -151,6 +155,12 @@ public class MultipleUploadListFragment extends SherlockFragment {
} }
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelableArrayList("photosData", photosList);
}
public void setData(ArrayList<Contribution> photosList) { public void setData(ArrayList<Contribution> photosList) {
if(this.photosList == null) { if(this.photosList == null) {
photosAdapter = new PhotoDisplayAdapter(photosList); photosAdapter = new PhotoDisplayAdapter(photosList);