I am trying to make an unit convertor when i change unit the result is not gating updated as showen in image
When i select unit any unit from menu the conversion must be visable on textview
here is code:-
public class UnitMenu extends BottomSheetDialogFragment {
ListView unitList;
String set;
String[] units;
ExtendedFloatingActionButton button;
UnitMenu(String[] units, String set, ExtendedFloatingActionButton button) {
this.units = units;
this.set = set;
this.button = button;
}
@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.area_select_unit, container, true);
unitList = view.findViewById(R.id.unitList);
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), android.R.layout.simple_list_item_1, units);
unitList.setAdapter(adapter);
unitList.setOnItemClickListener((parent, v, position, id) -> {
if (set.equals("Select Unit From"))
ConverterActivity.setSelectedFromUnit(units[position]);
else ConverterActivity.setSelectedToUnit(units[position]);
button.setText(units[position]);
dismiss();
});
return view;
}
}



Please add your code when call show your dialog to get better answer. normally i would use callback like that: