1

I'm building an app the captures the data of a listitem by clicking on it. I'm able to pass the MarketID through an intent however I want to pass it using a dialog to change specific data. So how do I .putExtra for a dialog. Thanks

Here's the code

int position = viewHolder.getAdapterPosition();
        int marketID = markets.get(position).getMarketID();
        FragmentManager fragmentManager = getSupportFragmentManager();
        SuperMarketRaterDialog superMarketRaterDialog = new SuperMarketRaterDialog();
        superMarketRaterDialog.putExtra("marketID", marketID);
        superMarketRaterDialog.show(fragmentManager,"RateMarket");
Martin Zeitler
  • 1
  • 19
  • 155
  • 216
  • Does this answer your question? [passing argument to DialogFragment](https://stackoverflow.com/questions/15459209/passing-argument-to-dialogfragment) – ADM Mar 25 '21 at 03:40

1 Answers1

0

The most obvious approach might be, to pass it into the DialogFragment constructor:

SuperMarketRaterDialog superMarketRaterDialog = new SuperMarketRaterDialog(marketID);

Unless using the navigation component, there's no way to pass navigation Arguments.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216