Java Question How to Override methods when using AbsObjectWrapper

barx

Well-Known Member
Licensed User
Longtime User
Ok lets say we have this code in a tutorial for 'something'.

B4X:
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        someclass.setListener(_listener);
    }

  SomeListener _listener = new SomeListener() {

        @Override
        public void onStart() {
            super.onStart();
            Log.i(TAG, "SomeListener.onStart");
        }

        @Override
        public void onComplete(boolean completed) {
            super.onComplete(completed);
            Log.i(TAG, "SomeListener.onComplete");
        }

        @Override
        public void onException(Exception e) {
            super.onException(e);
            Log.i(TAG, "SomeListener.onException");
        }

    };
}

Now obviously other bits of code are missing, but you should get the idea from this. Now I wish to implement this into a library and use AbsObjectWrapper. So how would I go about Overriding the methods to raise BA events.

I've tried

B4X:
((SomeClass)getObject()).setListenet(new SomeLIstener) {
    @Override
    blah
    blah
}

But that no worky.

I tried laying it out similar to the tutorial but ba is not available to use ba.RaiseEvent.

Anybody understanding my primitive attempt at a Java question?
Any ideas on the answer?
 

barx

Well-Known Member
Licensed User
Longtime User
Good point, didn't think of that, I was a little tired yesterday. I will give it a go.

Thanks
 
Top