Android - Get a View (EditText) by ID from an ListView or ArrayAdapter
<p>I have an application in android which lets you manage your school grades. It is just a project for learning so nothing serious.  </p>

<p>Now if you open the details from a subject you can see the grades and edit them. If you then click on save I have to check if something changed or something new was added.<br>
Now my problem is that I don't now how I can get a specific view from a ArrayAdapter or from the ListView because every one of those grade fields are generated by the ArrayAdapter and I have to check them all for changes.</p>

<p>So I have a ArrayAdapter which fills a ListView with the following elements (list_grades_prefab.xml):</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingLeft="10pt"
    android:weightSum="2"
    android:orientation="horizontal"&gt;

    &lt;EditText
        android:id="@+id/grade_field"
        android:textSize="10pt"
        android:textAlignment="center"
        android:layout_weight="1"
        android:layout_marginRight="10pt"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" /&gt;

    &lt;EditText
        android:id="@+id/weight_field"
        android:textSize="10pt"
        android:textAlignment="center"
        android:layout_weight="0.7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" /&gt;

    &lt;TextView
        android:layout_weight="0.3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="10pt"
        android:textStyle="bold"
        android:text="%"/&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>Heres the getView of the ArrayAdapter:</p>

<pre><code>    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = new ViewHolder();

        if(convertView == null){
            LayoutInflater layoutInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = layoutInflater.inflate(R.layout.list_grades_prefab, null);
            viewHolder.GradeField = (EditText) convertView.findViewById(R.id.grade_field);
            viewHolder.WeightField = (EditText)convertView.findViewById(R.id.weight_field);

            convertView.setTag(viewHolder);
        }else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.GradeField.setText(String.valueOf(Grades.get(position)[0]));
        viewHolder.GradeField.setTextColor(BasicFunctions.colorFromGrade(Grades.get(position)[0]));
        viewHolder.WeightField.setText(String.valueOf(Grades.get(position)[1]).split("\\.")[0]);

        return convertView;
    }
</code></pre>

<p>It just fills the different EditText views with text.</p>

<p>Here I set the ArrayAdapter (GradesAdapter):</p>

<pre><code>ListView gradeListView = (ListView)findViewById(R.id.grade_list_view);
GradesAdapter gradesAdapter = new GradesAdapter(this, R.layout.list_grades_prefab, grades);
gradeListView.setAdapter(gradesAdapter);
</code></pre>

<p><em>grade_list_view</em> is the ListView and grades is an two dimensional array type double.</p>

<p>How do I get now every EditText with the id grade_field from the ArrayAdapter when I am not inside the getView method?</p>