How to choose the account for making events through the calendar intent?

Viewed 11

So I'm currently trying to make an app that will let the user make an event through my app, was just wondering if it's possible to choose the account on where the event will be set? For reference, this is the part I'm talking about, the one boxed in red.

Here's my code so far

addEvent.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if
            (!title.getText().toString().isEmpty() && !location.getText().toString().isEmpty()
                    && !description.getText().toString().isEmpty()) {
                Intent intent = new Intent(Intent.ACTION_INSERT);
                intent.setData(CalendarContract.Events.CONTENT_URI);
                intent.putExtra(CalendarContract.Events.TITLE, title.getText().toString());
                intent.putExtra(CalendarContract.Events.DESCRIPTION, description.getText().toString());
                intent.putExtra(CalendarContract.Events.EVENT_LOCATION, location.getText().toString());
                intent.putExtra(CalendarContract.Events.ALL_DAY, "true");
                intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, timeInMS);
                intent.putExtra(Intent.EXTRA_EMAIL, "email@example.com", exampl32e@gmail.com");
                if(intent.resolveActivity(getPackageManager()) !=null){
                    startActivity(intent);
0 Answers
Related