According to this rule, how do I click the button (BACK) and save the dates I chose?

Asked

Viewed 81 times

-1

inserir a descrição da imagem aqui

public class Calendario extends AppCompatActivity implements View.OnClickListener {


Button voltar;
com.prolificinteractive.materialcalendarview.MaterialCalendarView calendarView;
@Bind(R.id.calendarView)
MaterialCalendarView widget;
UserLocalStore userLocalStore;

private int currentTileSize;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_calendario);
    ButterKnife.bind(this);

    voltar = (Button) findViewById(R.id.voltar);
    calendarView = (com.prolificinteractive.materialcalendarview.MaterialCalendarView) findViewById(R.id.calendarView);

    voltar.setOnClickListener(this);

    currentTileSize = MaterialCalendarView.DEFAULT_TILE_SIZE_DP;

    userLocalStore = new UserLocalStore(this);
}


@OnClick(R.id.button_clear_selection)
void onClearSelection() {
    widget.clearSelection();
}

@OnClick(R.id.button_selection_mode)
void onChangeSelectionMode() {
    CharSequence[] items = {
            "Nenhuma seleção",
            "Uma Data",
            "Multiplas Datas"
    };
    new AlertDialog.Builder(this)
            .setTitle("Selecione o modo:")
            .setSingleChoiceItems(items, widget.getSelectionMode(), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    widget.setSelectionMode(which);
                    dialog.dismiss();
                }
            })
            .show();
}

private static final int[] DAYS_OF_WEEK = {
        Calendar.SUNDAY,
        Calendar.MONDAY,
        Calendar.TUESDAY,
        Calendar.WEDNESDAY,
        Calendar.THURSDAY,
        Calendar.FRIDAY,
        Calendar.SATURDAY,


};


@Override
public void onClick(View v) {
    switch(v.getId()){
        case R.id.voltar:
            userLocalStore.setUserLoggedIn(true);
            Intent loginIntent = new Intent(this, MainActivity.class);
            startActivity(loginIntent);
            break;

    }
}

}

1 answer

1


First you have to create an array type the code below.

public void onDateSelected(@NonNull MaterialCalendarView widget, @Nullable CalendarDay date, boolean selected) {

        oneDayDecorator.setDate(date.getDate());

        ArrayList<String> list = new ArrayList<String>();
        list.add(getSelectedDatesString());
        int i=0;
        Log.d("value", list.get(i));

    }

As it has been for a long time, if you have managed to share your solution.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.