All Questions
812
questions
0
votes
2
answers
67
views
How can a Callable return a value from a predefined void callback?
I am using a data-related API interface which has a key void callback function that is automatically invoked to mark the end of some IO operations. I want to make the class Callable<String> and ...
-2
votes
0
answers
59
views
Can callback to an incompletely constructed Java object be well-defined?
If a constructor of a class T passes this to as an argument to some method foo, and foo immediately performs a callback to the T object (which has not yet finished executing its constructor), things ...
2
votes
3
answers
3k
views
Android Webview EvaluateJavascript sometimes does not return a response
I have been trying to fix this for weeks and have no clue what is causing the issue. In my project I am utilizing the Android Webview's evaluateJavascript() method like this:
this.runOnUiThread(...
2
votes
1
answer
79
views
Java - Use null comparison or instanceof?
Below is a Java class constructor which accepts a callback for error handling. null should be an acceptable value, and if the passed value is null then skip error handling.
I have two ways of checking ...
0
votes
1
answer
37
views
linked hashmap get the first inserted
I have this LinkedHashMap which keep the order of the K-V pairs on the insertion order.
Map<Integer, String> map = new LinkedHashMap<>();
for (int i = 0; i < 1000000; i++) {
if (i =...
0
votes
0
answers
63
views
TelephonyCallback.CallStateListener with LiveData and ViewModel
I'm new to both android and java, now im trying to update a textview with the state of the call, but the view model doesn't get the value from the telephony callback class.
Im using post value since ...
0
votes
1
answer
23
views
How to get variable from GWT Callback
I'm trying to get a state of a server variable using a callback. Obviously, the state is always false. How can I get the state from the server? Or another question, which options do I have to get ...
0
votes
0
answers
105
views
How can I use APISetu to get documents from DigiLocker
I am trying to integrate DigiLocker APISs into my program. I am confused about lots of things, I need stepwise details to use DigiLocker to perform the following tasks:
First open DigiLocker page for ...
0
votes
1
answer
51
views
Java - receive a method that takes any number/type of parameters as method parameter
I'm implementing a Console Menu class in Java, roughly it looks like this:
public class ConsoleMenu {
private Scanner s = new Scanner(System.in);
private ArrayList<String> menuItems = ...
0
votes
1
answer
84
views
Calling functions from WebView to JS
In the java code(container) i have to get some values by calling some javascript functions, for this im using webView.evaluateJavascript, the problem is that i get the callback only when all the code ...
10
votes
2
answers
4k
views
Kotlin result type in java
Kotlin introduced the new type: Result.
I use it as a completion handler of several functions like this:
fun myFunction(completion: (Result<Boolean>) -> Unit)
Unfortunately I cannot use it ...
0
votes
1
answer
2k
views
onBackPressed is deprecated - webView in android app
I have an app where the main activity (which extends ComponentActivity) is pretty much just a webView. I have overriden onBackPressed, shown below.
@Override
public void onBackPressed(){
if(this....
1
vote
1
answer
96
views
Make a callback with JAVA RMI
I am currently implementing a kind of bag of tasks using Java RMI. The goal is for a "Client" to submit "Task" objects to a "Server," and on the other hand, I have "...
0
votes
1
answer
43
views
What thread should callbacks occur on in Java?
I'm developing a Java library that runs a scheduled task in a ScheduledExecutorService. If the user specifies callback(s), then after that task, those callback(s) will be invoked.
Right now I just ...
0
votes
1
answer
73
views
Callback function's byte parameter has value out of bounds in project Panama function interface
I'm using the new Foreign function & memory API which is part of project Panama and available in preview in JAVA 19.
This is a simple Java callback function
public static byte addFive(byte t) {
...