Question

I have a scroll view with table layout of 14 rows and each row is having 2 EditText Fields. I have button which the user clicks and the program computes and prints the answer. The problem is as soon as the user clicks the button and then makes changes in the EditText and again clicks the button and then scrolls up the character entered in changed EditText field disappears but when the user clicks on it it reappers. Please help me to solve this problem. Here is the xml file.

Problem in Detail:-
1. User enters the text in the EditText Fields.
2. User clicks the button.
3. User makes change in one or more EditText Fields.
4. User Clicks the button.
5. The character entered in the last changed EditText Field disappears.

Link To Full XML Code:- http://pastebin.com/G01TcXN1

Link To Full JAVA Code:- http://pastebin.com/utRMQ60B

Please help me to solve this problem.

Was it helpful?

Solution

I solved it I just changed from RelativeLayout To LinearLayout That there solved the problem for me.

OTHER TIPS

You can follow below code might be it is helpful for you.

if (convertView == null) {

        holder = new ViewHolder();

        LayoutInflater vi = (LayoutInflater)    
        getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = vi.inflate(R.layout.element_in_game, null);

        holder.scoreToUpdate = (EditText) convertView
                .findViewById(R.id.elementUpdateScore);

        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();

    }
   initScoresToUpdateEditTexts(holder.scoreToUpdate, hint);
   holder.scoreToUpdate.setText(scoresToUpdate[tmp_position]);
   holder.scoreToUpdate.addTextChangedListener(new TextWatcher() {

            @Override
            public void onTextChanged(CharSequence s, int start,
                    int before, int count) {
                scoresToUpdate[tmp_position] = s.toString();
            }
        });

    return convertView;
}

Or you can also refer this LINK

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top