Show dialog fragment from adapter

public class TestPagerAdapter extends PagerAdapter{
 
   private Context context;
 
   public YourPagerAdapter(Context c) {
          this.context = c;
   }
 
   @Override
      public void onClick(View v) {
            FragmentActivity fragmentActivity = (FragmentActivity)(context);
            FragmentManager fragmentManager = fragmentActivity.getSupportFragmentManager();
            TestPagerAdapter alertDialog = new YourDialogFragment();
            alertDialog.show(fragmentManager, "Fragment Alert Text");
      }
}
Please follow and like us:
Content Protection by DMCA.com