私はEditTextデータを入力するために使用していますが、表示がオフになったりオンになったりすると、入力したすべてのデータがクリアされ、Androidバージョン2.2.2を使用しています。
私のコードはここにあります:
  public void placeView() {    
        mEditText = new EditText(mContext);
        mTextView = new TextView(mContext);
        mEditText.setSingleLine();
        mEditText.onSaveInstanceState();
        mEditText.setImeOptions(EditorInfo.IME_ACTION_DONE);
        mTextView.setTextColor(mContext.getResources().getColor(R.color.white));
        mTextView.setTextColor(Color.WHITE);
        mtableRow = new LinearLayout(mContext);
        LinearLayout.LayoutParams trLayoutParams = new LinearLayout.LayoutParams(
                android.view.ViewGroup.LayoutParams.FILL_PARENT,
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        mtableRow.setOrientation(LinearLayout.VERTICAL);
        mtableRow.setLayoutParams(trLayoutParams);
        LayoutParams tvLayoutParams = new LayoutParams(
                android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        LayoutParams edtLayoutParams = new LayoutParams(
                android.view.ViewGroup.LayoutParams.FILL_PARENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        mEditText.setLayoutParams(edtLayoutParams);
        mTextView.setLayoutParams(tvLayoutParams);
        mTextView.setTextSize(20);
        mtableRow.addView(mTextView);
        mtableRow.addView(mEditText);
        mtableRow.setPadding(10, 5, 10, 5);    
    }