View Issue Details

IDProjectCategoryView StatusLast Update
0000198MantisDroid[All Projects] Defectpublic2012-05-22 06:38
Reportere7andy Assigned Toe7andy  
PriorityurgentSeveritymajorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version 
Target Version1.0Fixed in Version1.0 
Summary0000198: Handle orientation changes the correct way in issue and project lists
DescriptionRetain issue lists between orientation changes.

Handle orientation changes the correct way:

http://developer.android.com/guide/topics/resources/runtime-changes.html

@Override
public Object onRetainNonConfigurationInstance() {
    final MyDataObject data = collectMyLoadedData();
    return data;
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final MyDataObject data = (MyDataObject) getLastNonConfigurationInstance();
    if (data == null) {
        data = loadMyData();
    }
    ...
}
TagsNo tags attached.

Activities

e7andy

2012-05-16 13:03

administrator   ~0000008

Last edited: 2012-05-16 13:14

View 5 revisions

IssueListActivity.java:
Construct List<Project> projects = new ArrayList<Project>() in GetProjectsTask.
No need to clear the list on each execution.

Change order to:
issuesCollectionPagerAdapter = new IssuesCollectionPagerAdapter(this, getSupportFragmentManager());
viewPager.setAdapter(issuesCollectionPagerAdapter);
populateProjectSpinner();

Save position:
        if (savedInstanceState != null) {
            bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
        }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putInt("tab", getActionBar().getSelectedNavigationIndex());
    }

------------------------------------------------
IssuesCollectionPagerAdapter.java:

http://stackoverflow.com/questions/7263291/viewpager-pageradapter-not-updating-the-view
Test:
public int getItemPosition(Object object) {
    return POSITION_NONE;
}

Issue History

Date Modified Username Field Change
2012-05-15 12:58 e7andy New Issue
2012-05-15 12:58 e7andy Assigned To => e7andy
2012-05-15 12:58 e7andy Status new => assigned
2012-05-16 13:03 e7andy Note Added: 0000008
2012-05-16 13:05 e7andy Note Edited: 0000008 View Revisions
2012-05-16 13:11 e7andy Note Edited: 0000008 View Revisions
2012-05-16 13:13 e7andy Note Edited: 0000008 View Revisions
2012-05-16 13:14 e7andy Note Edited: 0000008 View Revisions
2012-05-21 09:28 e7andy Description Updated View Revisions
2012-05-22 06:38 e7andy Status assigned => closed
2012-05-22 06:38 e7andy Resolution open => fixed
2012-05-22 06:38 e7andy Fixed in Version => 1.0