Giovanni Montano

Ranch Hand
+ Follow
since Apr 29, 2014
Merit badge: grant badges
Biography
Based in the Netherlands, I am Italian, this is not my real name, but similar.
Like Running, Bach, Plato, History, Football, Chess, Green tea, anthropology, psychology, statistics.
Android/Java/Python/Emacs with Vim, Machine Learning
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Giovanni Montano

apart that ranchaversary is really cool as a name, and opens a reflection on my self when i tried to become a dev and everybody was saying that I should not switch career at 40 years. this forum helped me a lot to achieve proficiency and tackle junior issues and relax with the meaningless drivel forum


4 months ago
write here https://github.com/jython/jython/issues/

Please look before in internet how you are supposed to write an issue in github is the official repository, so is good if you do your homeworks

good luck!
7 months ago
Is the random code generated(just add some logs) is the Recycler view generated? Pplease furnish some `Log.d` So that we can debug together
1 year ago

Charles Ongky wrote:But in May 26 post there is no edit button. There is only quote button.


please check this llnk from official documentation to print from Android link
1 year ago
use the xml way to proceed as per documentation"


and then
1 year ago

Mary Alexis wrote:Good day! I am a beginner in flutter and I tried creating a mask detector. However, I encountered this error every time I select a picture in the gallery or capturing a pic in my camera.


Please consider that Flutter is not Android native, but a mobile platform written in a different language called Dart, that usually does not have Android native performance.
By the way i suggesti you to check the fact that s ince Friday is in alpha the library to write in Jetpack Compose the iOS UI, so I am not sure how long Flutter will last if native is taking the same path of Dart

I suggest you to breakpoint the line


you are possibly getting a null value.
try to "hardcode" the text passing a value as "fine" instead of fine  in Text("fine") and see if is working, if is giving you the output fine


1 year ago

Eduardo Silva wrote:Hello,

there a possibility of optmize this following partial solution to hide one widget totally opaque?

  • Hiding a Window when capturing screen content using MediaProjection

  • It looks as a real hedge case, I suggest you to try the Stack Overflow suggestion yourself. Is quite though per se, let alone without a context. Good luck and sorry if I cannot be more helpful
    1 year ago

    B Collins wrote:Hi

    tried to save some data in Kotlin on my device

    but how can I get programatically the default data directory to store the file?

    Help would be great


    you may  want to use the `File` API and `openFileOutput` function to store the data locally.
    1 year ago

    Mick Dawdy wrote:Thank you for this good information



    Here a working example, this is the way you would pass a modern code review in the industry:
    please notice the comments //first //second etc, this is the way the log will appear using async instead of launch:



    Notice result is returned when both the functions are BOTH returned, the same you can do if you really want to execute a first call and wait for the result, just use `await` and assign to a variable the flow will stop, here you are making both the call in parallel (faster), and when both of them are executed a result is returned.

    If you want the use case of running first function1 that has a delay of 1 sec, and then function 2 that has a delay 10 times slower(should run before in theory) you can use withContext



    as this link explains:

    function 2 executes faster than function 1 since function 2 has less delay then function 1. Since withContext is a suspend call, that is it won’t go to the next line until it finished. Since withContext is a suspend call and does not block the main thread, we can do other tasks while the IO thread is busy in executing function1 and function 2.



    a suspend call  is a function that could be started, paused, and resumed.
    usually you use the  keyword suspend:



    Once you understand these 3 concepts suspend, launch and await, you an safely run threads without so called race concurrency problems, this is the magic of the "structured concurrency" you isolate/encapsulate the thread and can use entry and exit points you want, and manage as a police man with the traffic all the other threads as you like, also in this way you can propagate eventual errors and manage in an easier way,

    There is another layer of complexity that is managing parent and child threads, basically you can define that a child fails independently from the other children or that terminates even the parent, this allow you great architectural choices.
    1 year ago
    The only think I can relate is spotify, when I listen to it and then switch to youtube and open a video the audio switches to youtube. Is how should work I guess, please which app has a different behavior, you mentioned one right?  
    1 year ago

    john bean wrote:k i was testing on different device with higher sdk which since oreo needs a channel for notifications and it works fine on the higher sdk running lineage



    so if it is in the if statement it works if it is in the else statement it stops for assistant



    really good, as i told you before Services are a pain because Android manage them differently because of privacy, security, and battery optimizations. Well done!
    1 year ago

    john bean wrote:thanks for reply there is nothing of use in logcat the only 3 lines printed are


    the only reason i know it is being paused is the toasts stop when voice assistant is opened and resume when it closes before i put in toasts i just assumed my service was not running the aim is to kill the microphone completely unless it is manually turned on by the user  never really worked with services before trying to fumble through it and learn it does work during phone calls its just google voice search that pauses my service


    ok i still have problems to understand what you want to achieve, i do not get when you said that you start the service "then you go to youtube" press search with voice and there is another app that works, if you take your time to write sequentially what do you expect and what happens i can help.

    please consider that in the companies there is a way to describe the bugs: steps you take to reproducesequentially, 1,2, 3 ex from screen one i put the app in background pressing the soft button back, then i open youtube, and i press voice search.
    I EXPECT
    that.....
    WHAT INSTEAD HAPPENS
    is......

    note: there is an app called spotify that when i press etc
    1 year ago

    john bean wrote:Thanks for replies yeah i was doing it all wrong hit a few youtube videos on services have a bit of a better idea now thanks for the code very helpful


    glad it helped please check the boolean state also in the second example
    1 year ago
    I apologize but i do not understand exactly what you want to achieve, namely when exactly you expect the service to not get stopped? Which application, which precise action?
    Just in the case may  be still helpful,  please consider also me and Tim replied you in your previous post from 6 days ago about the use of Service.

    You put some logs, what is the flow behavior, is the `ondestroy` callback called when expected and if so  is the boolean  flag value changed?
    1 year ago

    Mick Dawdy wrote:

    Does anyone have a favorite, good basic introduction to this topic?  Especially one with an introductory level example?

    Hopefully, next time I will have some code to show

    Thank you,
    Mick



    Sure we need to distinguish two cases. 1) You are interested in the theory of the concurrency 2) you want  to utilize what  currently the industry uses.

    1) too broad topic and too many tools to use, since roughly 2011 is not common anymore to see in Android Thread and Pools at a low level, but with specific tools google engineers offered dedicated abstrations and unfortunately some of them are deprecated.
    2) you may want to use coroutines, they simplify in a great way how to manage structured concurrency, and are defined( improperly) as light weight threads. Basically they use a system of caching and deferring calls simplifying the readability of your code and giving you full control for your use case.
    I suggest you to look for the two options `launch` and `async` both of them can be used for your use case.

    If really you want to go deep with Threads, I suggest you the dedicated chapter on Head first Java as an introduction, and then a book called java concurrency in practice, the second one is the bible of the concurrency in java. I repeat good to know, but in 2023 nobody is going to land on a job without knowing more industry modern methods, RXJava, and coroutines with Flow at least.