If the user is putting data in edittext fields and orientation get changed, the onConfigChange method is called and new layout is populated,with empty edittext fields, i want to retain the data in edittext fields entered by user befor orientation change. Any kind of help will highly appreciated.
 protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            int orientation_default = getResources().getConfiguration().orientation;
            switch (orientation_default) {
            case Configuration.ORIENTATION_PORTRAIT: {
                setContentView(R.layout.registration);
                break;
            }
            case Configuration.ORIENTATION_LANDSCAPE: {
                setContentView(R.layout.registration_horizontal);
                break;
            }
            }
            findViewById(R.id.backtohomepage).setOnClickListener(this);
            findViewById(R.id.backtologinpage).setOnClickListener(this);
            findViewById(R.id.btn_notregyetsubmit).setOnClickListener(this);
            findViewById(R.id.termsandconditions_id).setOnClickListener(this);
            findViewById(R.id.btn_notregyetsubmit).setOnClickListener(this);
        }
        @Override
        public void onConfigurationChanged(Configuration newConfig) {
            super.onConfigurationChanged(newConfig);
            if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
                setContentView(R.layout.registration);
                findViewById(R.id.termsandconditions_id).setOnClickListener(this);
                findViewById(R.id.backtohomepage).setOnClickListener(this);
                findViewById(R.id.backtologinpage).setOnClickListener(this);
            } else if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
                setContentView(R.layout.registration_horizontal);
            }
            findViewById(R.id.backtologinpage).setOnClickListener(this);
            findViewById(R.id.btn_notregyetsubmit).setOnClickListener(this);
            findViewById(R.id.termsandconditions_id).setOnClickListener(this);
            findViewById(R.id.btn_notregyetsubmit).setOnClickListener(this);
        };
 
     
     
    