我正在为一个应用程序编写代码,我可以在其中创建事件,这些事件将以我写的标题和说明显示在日历中。问题是我似乎无法不覆盖前一个就创建它们。我尝试过的每个解决方案都只能覆盖它们,或者不起作用。这是日历代码的相关部分:
import static com.example.alumnos.alumni.Fragments.CreateEventsFragments.EventsTypesFragment3.eventDescription;
import static com.example.alumnos.alumni.Fragments.CreateEventsFragments.EventsTypesFragment3.eventTile;
import static com.example.alumnos.alumni.Fragments.CreateEventsFragments.EventTypesFragment.idTypeEvent;
public class Calendar_Fragment extends Fragment {
public GregorianCalendar cal_month, cal_month_copy;
private HwAdapter hwAdapter;
private TextView tv_month;
private String tipo;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
switch (idTypeEvent){
case 1: tipo = "Evento";
break;
case 2: tipo = "Oferta de trabajo";
break;
case 3: tipo = "Notificación";
break;
case 4: tipo = "Noticias";
break;
}
View view = inflater.inflate(R.layout.fragment_calendary, container, false);
HomeCollection.date_collection_arr=new ArrayList<HomeCollection>();
HomeCollection.date_collection_arr.add( new HomeCollection("2019-03-12" ,eventTile,tipo,eventDescription));
使用此代码显然会在每次创建事件时将其覆盖,但我不知道如何使它不会。