How to retain EditText data on orientation change?

后端 未结 12 1927
暗喜
暗喜 2020-12-05 13:34

I have a Login screen which consists of 2 EditTexts for Username and Password. My requirement is that on orientation change , input data(if any) in EditText should r

12条回答
  •  庸人自扰
    2020-12-05 14:21

    Im restoring instance to restore values and it works fine for me :)

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.addtask2);
        if(savedInstanceState!=null)
         onRestoreInstanceState(savedInstanceState);
    
    }
    

提交回复
热议问题