show dialog fragment from adapter

Solutions on MaxInterview for show dialog fragment from adapter by the best coders in the world

showing results for - "show dialog fragment from adapter"
Franco
30 Aug 2018
1public class YourPagerAdapter extends PagerAdapter{
2
3   private Context context;
4
5   public YourPagerAdapter(Context c) {
6          this.context = c;
7   }
8
9   @Override
10      public void onClick(View v) {
11            FragmentActivity activity = (FragmentActivity)(context);
12            FragmentManager fm = activity.getSupportFragmentManager();
13            YourDialogFragment alertDialog = new YourDialogFragment();
14            alertDialog.show(fm, "fragment_alert");
15      }
16}
17