I am using a grid view in my app's activity. Each grid view row contains three check boxes which can be set to selected/ not selected based on what user wants to query from database. The activity also includes an editText which causes an onScreenKeyboard to appear every time activity starts and here I am having problem. OnScreenKeyboard, when appears disturbs gridview and some of its checkboxes simply disappear. My idea was to refresh grid view every time configuration changes. I tried handling this by returning an object through onRetainNonConfigurationInstance(). Object contains an array list to populate my gridview rows with but onCreate() when I use getLastNonConfigurationInstance() to retrieve returned object it shows null. Can anyone please suggest me that how to handle this issue or if there is any other approach available by which I can make my gridView behave normal on configuration change. Following is the code and i want to make it clear I have added keyboardHidden configuration change in manifest file but when key board appears it sometimes don't trigger onConfigurationChanged()
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.failureselection);
    findLocalWidgets(); //Initializes Layout Objects
    if(configchanged){
                    //Re populate grid view
                        customDataGridRows = (ArrayList<CustomGridViewRow>) getLastNonConfigurationInstance();
                        dgvwFailures.setAdapter(new CustomGridViewAdapter(this,
                                customDataGridRows));
                                configchanged = false;
                      }else{
                            fillFailuresList(customDataGridRows);
                            dgvwFailures.setAdapter(new CustomGridViewAdapter(this,
                                    customDataGridRows));
                    }
    }
@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    setContentView(R.layout.failureselection);
    configchanged = true;
}
@Override
public Object onRetainNonConfigurationInstance() {
    return customDataGridRows;
}
private boolean fillFailuresList(
        ArrayList<CustomGridViewRow> customDataGridRows) {
    boolean isFilled = false;
    try {
        // Adding Failures data
        customDataGridRows.add(new CustomGridViewRow(false, "Hood", false,
                "Assembly Defect", false, "Masking Poor"));
        customDataGridRows.add(new CustomGridViewRow(false, "Floor", false,
                "Forget Work", false, "Assembly Defect"));
        customDataGridRows.add(new CustomGridViewRow(false, "Grill", false,
                "Incorrect Assembly", false, "Bad Company"));
        customDataGridRows.add(new CustomGridViewRow(false,
                "R Right Frame", false, "Interference", false,
                "Fix Large Effort"));
        customDataGridRows.add(new CustomGridViewRow(false, "R Left Frame",
                false, "Leakage", false, "High Incidence"));
        customDataGridRows.add(new CustomGridViewRow(false, "R Frame",
                false, "Dirt", false, "Recurrence"));
        customDataGridRows.add(new CustomGridViewRow(false,
                "Outside R Frame", false, "Decal", false, "Checking"));
        customDataGridRows.add(new CustomGridViewRow(false,
                "F Right Frame", false, "Other", false, "Foreign Body"));
        customDataGridRows.add(new CustomGridViewRow(false, "F Left Frame",
                false, "", false, "Not Caulking"));
        customDataGridRows.add(new CustomGridViewRow(false, "F Frame",
                false, "", false, "Painting Defect"));
        customDataGridRows.add(new CustomGridViewRow(false,
                "Outsie F Frame", false, "", false, "Other"));
        customDataGridRows.add(new CustomGridViewRow(false, "", false, "",
                false, ""));
        // Populating Failures grid view
//      dgvwFailures.setAdapter(new CustomGridViewAdapter(this,
//              customDataGridRows));
        isFilled = true;
    } catch (Exception e) {
        e.getMessage();
    }
    return isFilled;
}
 
     
     
     
     
    
http://stackoverflow.com/questions/3121153/baseadapter-causing-listview-to-go-out-of-order-when-scrolled – Dharmendra Jan 09 '14 at 06:00