How to show an alert within an action group?

I have a tab bar inside my application, and I used a group of actions to maintain it. When I click these tabs, I have to show a set of actions. My problem is that I cannot show a warning dialog box or any other dialogs inside these actions. An error occurred: "Failed to add window." Can anyone tell how to solve this problem?

+3
source share
1 answer

It gives the above error due to the Context that I provided to the alertdialog builder.

Give:

new AlertDialog.Builder (getParent ()). setMessage ("Hello world"). show ();

We just need to call getParent () instead of AlertDialog.Builder (this)

+13
source

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


All Articles