Java. how to know that the function was executed? [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have loadGraphics() function in my app. It takes a lot of time to be executed. I want to make loading screen, while this function is running. Can I create inside callback, which would have notified me about the function succeeds? Thanks in advance.

Yes. Just create a private boolean that can only be accessed in the class, setting it to false initially. Before beginning that loadGraphics(), just start a basic thread that has a callback in it if that boolean is true.
Then just add a statement at the end of loadGraphics() that sets the boolean to true.

Related

Can Spring Boot async methods meet at one point? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Imagine I have two async methods and a main method. In the main method, one is called in line of code 1 and another in line of code 2. I want the code to be blocked in line of code 3 because I need the results of those 2 methods.
Is this possible in Spring Boot? What could I use?
You can use completableFuture.
https://www.baeldung.com/java-completablefuture#Multiple
CompletableFuture.allOf() or CompletableFuture.join() ll help;

Java Bukkit value function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Hello have problem with the value string and cant compile cause of this
screenshot of the error
https://i.stack.imgur.com/laGkq.png
can someone help? thanks!
You can't assign a generic type to a value in Java since it needs to know what's being set in the memory (for the length).
For more information, you should read a bit about Generic Types
It's hard without the that small amount of code to tell, but normally, if you remove the (T), you should not get that error.

how to draw infinte in a flowchart [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I was learning flowcharts, wanted to show this code in a flowchart, wanted to print infinite times without declaring a counter. please note I haven't declared any counter.
for (;;){
System.out.println("helloworld");
} }
An infinite loop is like any other loop an arrow that goes back to a previous point.
Usually, you still place a condition (rhombus/diamond shape) at the start of the loop as usual, but there is only one outgoing path.

how to get value of Threadlocal from current Thread in java? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
How to get value of Thread-local from current Thread?
I am trying to get the value of Thread-local from current Thread but can't find any help online.
Read the Javadoc for ThreadLocal. There are only 4 methods on ThreadLocal; the one you need is obviously ThreadLocal.get():
Returns the value in the current thread's copy of this thread-local variable.

Libgdx How do Block and Unblock Game Levels? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Im my level menu (I'm using libgdx), I would like to lock and unlock game levels.
Alowing player to unblock each game level after finishing the previous?.
Can someone point me an example?
Thanks in advance for any help comming this way.
PEACE!
This is just logic stored in variables between sessions.
Loop all of your levels
If the loop index is lower then or equal than your variable "howManyLevelsComplete" make then unlocked. Else you lock them
Save the "howManyLevelsComplete" variable to Preferences so you can keep track when the application restarts.
I wont provide code for this since it's basic game logic.

Categories

Resources