Java Question Handler

Johan Schoeman

Expert
Licensed User
Longtime User
I have this code inside a java activity that I am trying to wrap(Demo.java):
B4X:
    static class MyHandler extends Handler { 
        WeakReference<Demo> outerClass; 
     
        MyHandler(Demo activity) { 
            outerClass = new WeakReference<Demo>(activity); 
        } 
     
        @Override
        public void handleMessage(Message msg) {
            Demo theClass = outerClass.get(); 
            switch (msg.what) {
                case 1:
                    theClass.pd.dismiss();

How do I amend this to accommodate it in the B4A wrapper? A bit lost here....
 

Johan Schoeman

Expert
Licensed User
Longtime User
What are you expected to do with the handler? Pass it to a method?
The handler is called when for eg a button is clicked (in the original java activity). It seems to be mostly building Strings from byte data. I can probably bypass it and just add a method that will handle each case (message) that is passed to the handler.
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…