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

-1

publicclassCalendarioextendsAppCompatActivityimplementsView.OnClickListener{Buttonvoltar;com.prolificinteractive.materialcalendarview.MaterialCalendarViewcalendarView;@Bind(R.id.calendarView)MaterialCalendarViewwidget;UserLocalStoreuserLocalStore;privateintcurrentTileSize;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){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=newUserLocalStore(this);}@OnClick(R.id.button_clear_selection)voidonClearSelection(){widget.clearSelection();}@OnClick(R.id.button_selection_mode)voidonChangeSelectionMode(){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;

    }
}

}

    
asked by anonymous 28.11.2015 / 22:11

1 answer

1

First you have to create an array type 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 a long time, if you have already managed to share your solution.

    
23.03.2016 / 07:55