# Close meeting onBackPressed

**URL:** <https://devforum.zoom.us/t/close-meeting-onbackpressed/47519>\
**Category:** Android\
**Created:** [April 8, 2021, 10:44am UTC](https://devforum.zoom.us/t/close-meeting-onbackpressed/47519 "2021-04-08T10:44:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![abduljav123](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@abduljav123](https://devforum.zoom.us/u/abduljav123)\
**Post date:** [April 8, 2021, 10:44am UTC](https://devforum.zoom.us/t/close-meeting-onbackpressed/47519/1 "2021-04-08T10:44:50Z")

</div>

Ive been following the zoom docs to make my own personalized app. Ive played around with the Zoom android-example-sdk app and, following the docs, ive integrated zoom sdk into my own app as shown in the docs (importing the commonlib.aar and mobile.aar packages into my personal project). Ive come across a problem now.

I want that `onBackPressed` instead of just closing the application, it displays a custom `alertdialog` to close the meeting and on pressing the positive button `Yes` the meeting closes and it returns to the previous `activity` (which is MainActivity to be specific).

Ill easily make the custom `alertdialog` but the rest of it i need your help with. How do i make the meeting activity listen to the backpress and then perform the required actions? My file tree in android studio is as follows:

![tree](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/1/d/1d204e2cf97fbe8f28f62d59d55bf8be57cdd488.png)

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [April 9, 2021, 4:32pm UTC](https://devforum.zoom.us/t/close-meeting-onbackpressed/47519/2 "2021-04-09T16:32:54Z")

</div>

Hi @abduljav123, thanks for the post.

In order to programmatically leave the meeting, you can call [`leaveCurrentMeeting`](https://marketplacefront.zoom.us/sdk/meeting/android/us/zoom/sdk/MeetingService.html#leaveCurrentMeeting-boolean-).

Overriding the behavior of the back button is outside of the scope of what the SDK is responsible for, so if you are experiencing any issues on that front I would recommend checking out the official Android documentation. 🙂

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [May 10, 2021, 2:33am UTC](https://devforum.zoom.us/t/close-meeting-onbackpressed/47519/3 "2021-05-10T02:33:01Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
