0

I am trying to integrate Chrome Custom Tabs in my Android App. Here is the requirement where I am stuck:
1. List of pdfs being shown in GridView. The user when clicks on any pdf will be opened on custom tabs. Here I will pass the position of item in GridView.
2. This position will be used for selection. There will be a SELECT action on custom tab. When the user clicks on SELECT, the custom tab should close passing the position back to the activity so that I can mark that item in GridView selected.

Now the problem is in closing the Custom Tab and passing the data back to activity. Any help in this regard will be highly appreciated.

hemalp108
  • 1,209
  • 1
  • 15
  • 23
reactivedroid
  • 752
  • 1
  • 7
  • 14

1 Answers1

3

There is no such support currently to close chrome custom tab programatically.

But you can close it by starting your previous activity from where you launched chrome custom tab.

For this, set your activity launchMode as "singleTask" and then start your activity with FLAG_ACTIVITY_CLEAR_TOP when ACTION button is clicked.

Then chrome custom tab will be automatically closed and the previous activity will be shown from where chrome custom tab was opened.

You can check details from here: How to close chrome custom tabs .

mdrafiqulrabin
  • 1,657
  • 5
  • 28
  • 38