Я писал код, но я не уверен, что лучше. В одном случае легче читать, что происходит, но у меня больше строк кода. С другой стороны, у вас меньше строк кода, но я думаю, что это труднее понять.Какой код лучше?
String imp = importance.getSelectedItem().toString();
String title_str = title.getText().toString();
String body_str = body.getText().toString();
String location_str = location.getText().toString();
int day = date.getDayOfMonth();
int month = date.getMonth()+1;
int year = date.getYear();
int hh = time.getCurrentHour();
int mm = time.getCurrentMinute();
String date_str = year+"/"+month+"/"+day+" " + hh+":"+mm +":00"; // yyyy/MM/dd HH:mm:ss
long dateMilliseconds = new Timeconversion().timeConversion(date_str);
Conference conference = ConferenceBuilder.conference()
.id(idConf)
.importance(Double.parseDouble(imp))
.title(title_str)
.body(body_str)
.location(location_str)
.timeInMilliseconds(dateMilliseconds)
.build();
или
Conference conference2 = ConferenceBuilder.conference()
.id(idConf)
.importance(Double.parseDouble(importance.getSelectedItem().toString()))
.title(title.getText().toString())
.body(body.getText().toString())
.location(location.getText().toString())
// yyyy/MM/dd HH:mm:ss
.timeInMilliseconds(new Timeconversion().timeConversion(date.getYear()+"/"+date.getMonth()+1+"/"+date.getDayOfMonth()+" " + time.getCurrentHour()+":"+time.getCurrentMinute() +":00"))
.build();
Идите для удобочитаемости. И, к слову, слово «кусок», а не «мир». «Мир» означает не борьбу. –
Спасибо @MikeDunlavey – mavi
Также я думаю, что это лучше всего использовать в качестве java-вопроса. Я думаю, что нет ничего важного для Android или для этого требуется знание Android. –