Answers for "open dialog fragment on an adapter android"

2

show dialog fragment from adapter

public class YourPagerAdapter extends PagerAdapter{

   private Context context;

   public YourPagerAdapter(Context c) {
          this.context = c;
   }

   @Override
      public void onClick(View v) {
            FragmentActivity activity = (FragmentActivity)(context);
            FragmentManager fm = activity.getSupportFragmentManager();
            YourDialogFragment alertDialog = new YourDialogFragment();
            alertDialog.show(fm, "fragment_alert");
      }
}
Posted by: Guest on December-27-2020

Code answers related to "open dialog fragment on an adapter android"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language