Android Question Get modules-subs names by code

LucaMs

Expert
Licensed User
Longtime User

Thanks, Erel, but I didn't understand how can that snippet help, in this case.

I tried it, passing a null string as "FromSubName". I get a "long" list of rows (only 21, used in a very small project for tests).
Probably you mean that I should I consider only those lines which start with my app package name.
If I understand well, it shows only the routines called during the use of the application (the user could not use all of them).

BTW, to get those lines, I thought to call that routine (LogStackTrace) at "application end" so now I know that... I don't know "where" a B4J app ends (I mean that I have not found an "app closing" event - I should start a new thread for this question, I know ).


Thank you.
 
Upvote 0

Roycefer

Well-Known Member
Licensed User
Longtime User
The jAWTRobot library has a method called JVMAddShutdownHook() that allows you to handle graceful JVM shutdowns (that is, when the JVM shuts down under its own power, not when it's shut down by the OS or a Task Manager). This works in B4J UI and non-UI apps.

What are you trying to accomplish, overall? Are you trying to retrieve the stack trace of the Exception that is killing your app? The jAWTRobot allows you to redirect Standard Error to a text file. There's also some improved Exception handling features that will be released soon.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Try this, it's based on code found here: https://docs.oracle.com/javase/tutorial/reflect/class/classMembers.html

It shows a lot of methods that you won't be interested in you'll have to pick through. Works better on B4j, but it works for initialized Class objects (not code modules) in B4a, and class names as strings for classes in the API.

Depends on JavaObject and the Reflection lib
 

Attachments

  • ClassSpy.zip
    8.3 KB · Views: 161
Upvote 0

stevel05

Expert
Licensed User
Longtime User
If you look at the documentation, there are 4 levels of information. If you change the call from getMethods to getDeclaredMethods, you can lose some of the methods you're probably not interested in (inherited methods).
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
I've modified it for you, download it again and pass 3 as the infolevel for less info or 4 for all of it. (See the documentation for the differences)
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
At the moment, I can do it "by hand" (perhaps Erel will do this and I hope that he will change the "modules window" adding a TreeView).

Otherwise, I can accomplish this by acting on the source of the project, using part of my (underestimated ) AddLogs software.


Thank you very much, Steve


[I'LL TRY YOUR SW, OF COURSE!!!]
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…