When you want to extend another class in Fragment,

Asked 2 years ago, Updated 2 years ago, 156 views

public class Main_Title_Fragment : Fragment
{
    ImageButton _Back_Button, _Exit_Button;
    TextView _Title_Text;
    FragmentTransaction _Main_Menu_Fragment;
    FragmentManager _Back_Stack;


    public override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        _Main_Menu_Fragment = ChildFragmentManager.BeginTransaction();
        Main_Menu_Fragment _Setting = new Main_Menu_Fragment();
        _Main_Menu_Fragment.Replace(Resource.Id._Adapter_Content, _Setting);
        _Main_Menu_Fragment.Commit();
        // Fragment that opens by default when running the screen
    }

    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
    }

When there is a fragment in this way,

What should I do if I want to extend the class ABS?

fragment abstract-class

2022-09-21 23:09

1 Answers

If abs is interface, it will be possible, but if it is a normal class, it is not possible because the Fragment class is already extends. There is a way to extend the class after creating a new Fragment class by grafting the ABS class content into the Fragment. If you post the ABS class, I think I can answer in more detail


2022-09-21 23:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.