Wenn ich auf das Symbol „Hinzufügen“ klicke, füge ich eine Liste hinzu, mit der ich die leere editTextView füllen kann.
Das Problem tritt auf, wenn ich zwei Listen mit Elementen hinzugefügt habe: Als ich mit dem Vervollständigen der ersten Liste begann, stellte ich fest, dass die zweite die gleichen Daten enthielt.
Wie ich die Elemente jeder Liste trennen kann.
Dies ist die erste Liste, die ich eingegeben habe Test in Funktion

in der zweiten Liste I Ich habe festgestellt, dass Daten vom ersten übernommen werden

Meine Frage, wie man einen bekommt separates Formular?
Das ist mein Adapter:
Code: Select all
public class SectionAuthorAdapter extends com.applidium.headerlistview.SectionAdapter {
private MainActivity mainActivity;
private Realm realm;
private Author author = null;
private Authors_groups authors_groups = null;
private RealmList authors = new RealmList();
int num= 0;
private List authors_groupses;
public SectionAuthorAdapter(MainActivity mainActivity, List authors_groupses) {
this.mainActivity = mainActivity;
realm = Realm.getInstance(mainActivity);
this.authors_groupses = authors_groupses;
}
@Override
public int numberOfSections() {
return authors_groupses.size();
}
@Override
public int numberOfRows(int section)
{
if(section == -1)
section = 0;
return authors_groupses.get(section).getAuthors().size();
}
@Override
public View getRowView(int section, int row, View convertView, ViewGroup parent) {
final int id ;
//ViewHolder holder = null;
final ViewHolder holder;
if (convertView == null) {
holder = new ViewHolder();
LayoutInflater inflater = mainActivity.getLayoutInflater();
convertView = inflater.inflate(R.layout.listview_item_agent, null);
holder.textView1 = (TextView) convertView.findViewById(R.id.textView1);
holder.editText1 = (EditText) convertView.findViewById(R.id.editText1);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
realm.beginTransaction();
id = authors_groupses.get(section).getAuthors().get(row).getId();
authors_groups = new Authors_groups();
author = authors_groupses.get(section).getAuthors().get(row);
if (author != null) {
holder.textView1.setText(author.getField().getLabel() + " : ");
if (author.getData() != null && !author.getData().isEmpty())
{
holder.editText1.setText(author.getData());
}
holder.editText1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
holder.editText1.getId();
}
});
authors.add(author);
authors_groups.setAuthors(authors);
}
realm.commitTransaction();
return convertView;
}
@Override
public Object getRowItem(int section, int row) {
return null;
}
@Override
public View getSectionHeaderView(int section, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = (TextView) mainActivity.getLayoutInflater().inflate(mainActivity.getResources().getLayout(android.R.layout.simple_list_item_1), null);
}
section = section+1;
((TextView) convertView).setText("Témoin : " +section );
convertView.setBackgroundColor(mainActivity.getResources().getColor(R.color.android_green));
return convertView;
}
@Override
public boolean hasSectionHeaderView(int section) {
return true;
}
@Override
public void onRowItemClick(AdapterView parent, View view, int section, int row, long id) {
super.onRowItemClick(parent, view, section, row, id);
}
class ViewHolder {
TextView textView1;
EditText editText1;
}
}