Can't I use static and abstaract together?

Asked 2 years ago, Updated 2 years ago, 61 views

public abstract class AbstractDataInterface : Fragment, DataInterface
{

    public abstract void SetHandler(int dest, Handler handler);
    public abstract Handler GetHandler(int dest);
    public abstract int SendMessage(Handler handler, int dest, int cmd, Object o);
}

You have this class, and you inherit this class from the fragment

public class RD_TT_AIS_Fragment : AbstractDataInterface
{
    public override Handler GetHandler(int dest)
    {
        return AbstractDataInterface._Handler[dest];
    }

    public class MyHandler : Handler
    {
        public override void HandleMessage(Message msg)
        {
            base.HandleMessage(msg);

            _Handler = GetHandler(AbstractDataInterface.IDX_PROCS_DISP_DATA);
            _Message = _Handler.ObtainMessage();
            _Handler.SendEmptyMessageDelayed(0, 3000);

            Console.WriteLine("+++++++++++++++++++++++++++++++ Menu - A : " + A.Checked);
            Console.WriteLine("+++++++++++++++++++++++++++++++ Menu - B : " + B.SelectedItem);
            Console.WriteLine("+++++++++++++++++++++++++++++++ Menu - C : " + C.Progress);
            //handler.SendEmptyMessageDelayed(0, 200);

        }
    }
}

See ) I did not post all the codes Make these definitions. The problem is that it works fine in Android studios C#, in Zamarine

" _Handler = GetHandler(AbstractDataInterface.IDX_PROCS_DISP_DATA);" An error occurs that this part is only available when GetHandler is specified static. How do we solve this?

static abstract

2022-09-21 17:11

1 Answers

https://docs.microsoft.com/ko-kr/xamarin/android/internals/api-design You will understand if you look at the description of the internal class in .

Non-static nested classes, also called inner classes, are significantly different. They contain an implicit reference to an instance of their enclosing type and cannot contain static members (among other differences outside the scope of this overview).


2022-09-21 17:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.