Retrieving typed text in run-time EditText

1

In my project I have some EditText being generated at run time, the EditText number is variable. I need to retrieve the typed texts and store them in different variables, and then create a Json object with it.

Here is the method I use to create the EditText :

public View editText(String nmLabel, String tpRender) {
    EditText e = new EditText(getBaseContext());
    e.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    // e.setHint("DATE");

    if(tpRender.equals("NUMBER")) {
        e.setHint("NUMBER");
    }
    else if(tpRender.equals("DATE")) {
        e.setHint("DATE");
    }
    else if(tpRender.equals("TEXT")) {
        e.setHint("TEXT");
    }
    e.setTextColor(Color.BLACK);
    e.setTextSize(20);

    return(e);
}

How do I get the texts typed separately?

    
asked by anonymous 13.11.2015 / 18:42

1 answer

0

Assign a different id to each of them using e.setId(int id)

You can then access them using the findViewById() method of the view where they were inserted.

    
13.11.2015 / 19:07