How to return to my application by calling an external intention (api calendar) and doing some work?

I have a home screen widget with several buttons. One of them should call up the dialogue (phone) of the calendar to create a new event. So, I registered the listener on my widget button:

Intent intent = new Intent(Intent.ACTION_INSERT); intent.setData(CalendarContract.Events.CONTENT_URI); PendingIntent pi = PendingIntent.getActivity(this, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); updateViews.setOnClickPendingIntent(R.id.btnAdd, pi); 

When I click this btn in my widget, it launches a calendar dialog to create a new event - this is normal. But, having filled in all the fields and clicking โ€œFinishโ€ in the calendar, I would like to go back to my application (or to the main screen of my widget). Instead, I'm still in the calendar app. How to deal with this, or is it possible?

+4
source share
1 answer

You must first begin the operation of your application, which then begins this intention.

But the problem is with the Calendar application. Although he should only add actions to the back stack when starting from the widget, he does this all the time. See This Question Sent By Me:

http://code.google.com/p/android/issues/detail?id=28704

Thus, users will have to double-click back. Well, there are phones. If I remember him correctly (I canโ€™t check at the moment), everything works fine on tablets.

+2
source

Source: https://habr.com/ru/post/1442247/


All Articles