Get custom list value

1

Good afternoon, I'm working with a custom list, whose definition is as follows (CustomList.java):

public class CustomList extends ArrayAdapter<String> {

private final Activity context;
private final String[] Keys, Values;
//private final Integer[] imageId;

public CustomList(Activity context, String[] keys, String[] values) {
    super(context, R.layout.list_single, keys);
    this.context = context;
    this.Keys = keys;
    this.Values = values;
}

@Override
public View getView(int position, View view, ViewGroup parent) {
    LayoutInflater inflater = context.getLayoutInflater();
    View rowView = inflater.inflate(R.layout.list_single, null, true);
    TextView txtKeys = (TextView) rowView.findViewById(R.id.key);
    EditText txtValues = (EditText) rowView.findViewById(R.id.value);

    txtKeys.setText(Keys[position]);
    txtValues.setText(Values[position]);

    return rowView;
}

The layout of the list is (list.xml):

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TableRow>
    <TextView
        android:id="@+id/key"
        android:layout_width="wrap_content"
        android:layout_height="50dp" />

    <EditText
        android:id="@+id/value"
        android:layout_width="wrap_content"
        android:layout_height="50dp"
        android:inputType="numberDecimal"/>

</TableRow>

The second object I have defined as EditText since my intention is to be able to modify these values and, later, store it.

The problem I have is that I do not manage to store these values because, even though I create a method in the CustomList.java class, the values I have in the array are those obtained at the beginning of the execution of the application, so the values that it stores are the old ones and not the new ones.

Any solution to be able to do this correctly?

P.D. I do not know if I have expressed myself well. Any questions, I will try to explain it better.

    
asked by Jerónimo Díaz 11.01.2017 в 13:22
source

0 answers