【发布时间】:2021-06-26 14:30:40
【问题描述】:
enter image description hereAddMeetingActivity
@BindView(R.id.my_toolbar2)
Toolbar mToolbar;
@BindView(R.id.in_time)
EditText txtTime;
@BindView(R.id.in_place)
EditText txtPlace;
@BindView(R.id.in_comment)
EditText txtComment;
@BindView(R.id.participant)
EditText txtParticipant;
@BindView(R.id.participant2)
EditText txtParticipant2;
@BindView(R.id.participant3)
EditText txtParticipant3;
@BindView(R.id.participant4)
EditText txtParticipant4;
@OnClick(R.id.create)
void addMeeting(){
Meeting meeting = new Meeting(System.currentTimeMillis(),
txtTime.getText().toString(),
txtPlace.getText().toString(),
txtComment.getText().toString(),
);
mApiService.createMeeting(meeting);
finish();
}
我想在一个arraylist中添加4个四个EditText的字符串值,这些EditText是我输入参与者姓名的地方。然后我必须在 addmeeting() 方法中发送新列表,但我找不到怎么做。
public abstract class DummyMeetingGenerator {
public static List<String> participants = Arrays.asList(
"nouveau@gmail.com, ancien@gmail.com, super@gmail.com, nul@gmail.com");
public static List<Meeting> DUMMY_MEETINGS = Arrays.asList(
new Meeting(1, "14:00", "Room A", " Future Project ", participants ));
static List<Meeting> generateMeetings() {
return new ArrayList<>(DUMMY_MEETINGS);
}
这是为了让您更清楚地看到我想要做什么,我在 4 编辑文本中输入参与者的邮件,当我单击创建按钮时,它应该将我在 arraylist 中输入的邮件显示到 recyclerview 文本视图。我该怎么做?
如果您需要更精确的信息,请告诉我。谢谢
【问题讨论】:
-
首先你能提供你的Message类的大纲,其次这与arraylist有什么关系。您已经将三个 endittext 字段的文本设置到会议对象中。您在 generateMeetings 中创建了一个列表,但它已经分配了一个会议,因为您将 DUMMY_MEETINGS 复制到其中。那么你想在这里做什么。另外,您正在谈论在回收站视图中显示它。这与您在此处提供的代码无关
-
我真的很困惑,你想让我们做什么
-
应该在哪个方法中发生什么,请附上您要使用的类,以便我们知道可以访问哪些方法和字段(例如Message类)
-
使用
ArrayList和arrayList.add( item ) -
@GabrieleMariotti 是的,但他也在谈论发送数据和使用回收站视图
标签: java android arrays android-studio android-recyclerview