B4A Library ChatHead wrapper + GIF overlay

Smee

Well-Known Member
Licensed User
Longtime User
Oh WOW, just what I have been looking for, Thanks very much for your generous contribution and work. Is the 'Enable Drop' still being planned?
Thanks again
 

Star-Dust

Expert
Licensed User
Longtime User
It's very interesting, it resembles the StandOut library. But surely lighter. I'm looking for something like this.

Thank you very much, your projects are always interesting.

Do you have documentation to edit the project and to manage the events?
 

JordiCP

Expert
Licensed User
Longtime User
Is the 'Enable Drop' still being planned?
Sorry, I abandoned my plans to make the "drop" part , but shouldn't be too difficult as the source code is there in case someone wants to expand it.

Do you have documentation to edit the project and to manage the events?
It is not a library "per se" but just a working example based on the link of the first post. I will try to take a look a it this week and see if I can "clean"/improve/document something to make it easier to work with.
 

Star-Dust

Expert
Licensed User
Longtime User
If I had a bit of documentation I would try to build a library.

Sorry a question...
BUT if instead of extending an ImageView Object, it extends a Panel object. Can You Build a Flying App?
 
Last edited:

Smee

Well-Known Member
Licensed User
Longtime User
Hey JordiCp, thanks for this code it works perfectly in the demo. When I drop the oservice into a project and just call it with the lines
B4X:
    Starter.MYSERVICE=True
    StartService(oService)
'
the service is called but then hits an error at this line
B4X:
            myChatHead.instance=J.RunMethod("newInstance2",Array(J,id))
The error message I get is

*** Service (oservice) Create ***
** Service (oservice) Start **
Error occurred on line: 129 (oService)
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:131)
at aus.anyfcsapp.joe.oservice._init_elements(oservice.java:357)
at aus.anyfcsapp.joe.oservice._service_start(oservice.java:641)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at aus.anyfcsapp.joe.oservice.handleStart(oservice.java:116)
at aus.anyfcsapp.joe.oservice.access$000(oservice.java:19)
at aus.anyfcsapp.joe.oservice$1.run(oservice.java:81)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.onStartCommand(ServiceHelper.java:105)
at aus.anyfcsapp.joe.oservice.onStartCommand(oservice.java:79)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2990)
at android.app.ActivityThread.access$2200(ActivityThread.java:175)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:146)
at android.app.ActivityThread.main(ActivityThread.java:5602)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@42a86718 -- permission denied for this window type
at android.view.ViewRootImpl.setView(ViewRootImpl.java:793)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:278)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
at aus.anyfcsapp.joe.oservice$CustomImageView.sharedConstructing(oservice.java:721)
at aus.anyfcsapp.joe.oservice$CustomImageView.<init>(oservice.java:689)
at aus.anyfcsapp.joe.oservice.newInstance2(oservice.java:855)
... 30 more

I get the error no mater if i add the line activity.finish or not in the calling of the service

Can you advise of a possible solution?

Thanks again
 

JordiCP

Expert
Licensed User
Longtime User
Did you copy the needed permission to in manifest? (SYSTEM_ALERT_WINDOW)

additionally, in later android versions, a special permission must be granted (manually) so that it can draw on top of other windows. But possibly the crash is due to the reason above.
 

Star-Dust

Expert
Licensed User
Longtime User
A small question in the project is the module called "c". Do you need something?
 
Last edited:

Smee

Well-Known Member
Licensed User
Longtime User
Did you copy the needed permission to in manifest? (SYSTEM_ALERT_WINDOW)

No I did not think to check the manifest. Thank you so much that fixed the problem.
Thanks again, Love your work
 

JordiCP

Expert
Licensed User
Longtime User
A small question in the project is the module called "c". Do you need something?
No, I simply forgot that there, as one day I will forget my head somewhere

(regarding your other question, I just saw now the edit)
BUT if instead of extending an ImageView Object, it extends a Panel object. Can You Build a Flying App?

Not sure if can be done directly with B4A objects, I think not, since they need to be in an activity, but sincerely never tried it. My example is more limited to button/control and some experiments for an app that I started to develop, but is now frozen.

Based on similar principles (I think), but with a more complete implementation, there is also @Informatix's OverlayWindow library
 

Star-Dust

Expert
Licensed User
Longtime User
Last question : Why did you include these variables in Starter and not Oservice?
B4X:
Dim MYSERVICE As Boolean=False
Dim STICK_TO_BORDER As Boolean
Dim DOUBLETAPBEHAVIOUR As Int
Dim ENABLEDROP As Boolean=False
 

Star-Dust

Expert
Licensed User
Longtime User
I'll look at the Informatrix Library but I like to put my hands in to make something of mine. It is not a computer need, but thirsty to know.
 

JordiCP

Expert
Licensed User
Longtime User
Perhaps they make sense as global behaviour definitions which are not tied to a specific implementation (the one in oService). But don't take anything in my codes too seriously because I can apply other criteria or no criteria at all depending on the day, I am not a "clean" programmer
 

JordiCP

Expert
Licensed User
Longtime User
Yes, my code (the b4a adaptation) is free to do what you want. I don't remember if the original code had any type of license, but even if it didn't have any, it is always nice to put a link to the origin.
(Anyway the link in the first post doesn't seem to be active , perhaps it has been moved somewhere else... )
 

Star-Dust

Expert
Licensed User
Longtime User
I do not know how to find it from another side, do you have directions?
I also modify Java, with a lot of effort because I'm 12 years old that I do not write anything in Java
 

Star-Dust

Expert
Licensed User
Longtime User

Smee

Well-Known Member
Licensed User
Longtime User
Hi
I have modified the java code to accept a single tap and it works fine. However I am trying to add a long click event that does not work. the code is as follows
B4X:
        public void onLongPress(MotionEvent e) {       
            processBA.raiseEvent(null, "onLong_Press", index);
        }

Could you shed any light why this would not work? I have tried it both inside the public class GestureListener extends and outside of it. I do not get any errors thrown but it just does not respond
Many thanks for any help
 

Smee

Well-Known Member
Licensed User
Longtime User
Ahhh i worked it out, I forgot to do the event in lowercase
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…