Skip to main content

All Questions

Tagged with
0 votes
0 answers
48 views

Is it possible to compare two seperate instances of objects that are considered callbacks using the equals() method?

I have two seperate objects that are from the same class, and using them as callbacks. I would like to compare them at runtime in my app, because I'm relying on the equals method in some collection to ...
Ahmad Hamwi's user avatar
0 votes
0 answers
79 views

Inner class seems unnecessary in the example given in On Java 8 by Bruce Eckel

Bruce Eckel gives the following example in Chapter Inner Classed of the book On Java 8 to demonstrate the necessity of using an inner class instead of implementing an interface. But I found the code ...
Curious's user avatar
0 votes
2 answers
554 views

java callback function in case of an exception

I've to implement a callback mechanism in case of an exception. suppose i hv a code to call like , which takes 3 parameters inside a class called ServiceA serviceA.functionA(String str1, String str2, ...
avi's user avatar
  • 195
0 votes
0 answers
124 views

Why can't Java see the interface method?

I need to connect two Functions and a Consumer. To do this, I created a new interface FunctionToConsumer in which I implemented the atLast method. But the atLast method is just not visible. error: ...
Meetinger's user avatar
  • 355
0 votes
0 answers
97 views

How to make callback from one Class to Adapter in Android

When the center is activated, then there should be a call back to the Adapter class, which updates the list and make changes. Code for the Activation of the centre: public class ActivatePresenter ...
Manan Virmani's user avatar
1 vote
1 answer
640 views

Java - Interface - How do I assign a specific interface in multiple activities all together

I have a service which has an interface, I'm implementing the interface callback in multiple activities, but because of I'm calling the app instance on every activity's onCreate, the interfaces are ...
user avatar
0 votes
3 answers
33 views

Return value of interface method (no params) is acquired asynchronously. Can it be implemented?

I've been given an interface which is like this: MyInterface { List<FirebaseVisionFace> getFaceList(); } I have to implement it in a class (let's call it MyFirebaseFaceClass) in such a way ...
CodeNovice's user avatar
0 votes
2 answers
214 views

Java/Kotlin callback syntax - do I really need 2 callback definitions after conversion to Kotlin?

I have a problem that has been challenging me for a few days with no resolution (more directly, no resolution I feel is correct). The issue is around callbacks, Java implementation vs Kotlin ...
Kenneth Argo's user avatar
  • 1,757
0 votes
1 answer
256 views

Multiple interface implementations Android [duplicate]

I have an Activity which implements two interfaces for call backs on certain actions. I want to send a context of my Activity to another Class which will access the object of the specified callback. ...
user3034944's user avatar
  • 1,681
0 votes
3 answers
533 views

Listen to (register to) a specific method of interface without implement all the methods, Java

Interfaces are a good way to simulate callbacks. However, the class that implements an interface must override all the methods of this interface. Now, I have an interface interface MyInterface { ...
MMasmoudi's user avatar
  • 538
1 vote
1 answer
371 views

Py4J Callback Interface throws "Invalid interface name" when the packaged .jar is used as a plugin

My code is exactly the same as the example shown on py4j website: Implementing Java Interfaces from Python Except my classes are all in the same src.main.java package (see below for the code) ...
bryantC's user avatar
  • 45
0 votes
1 answer
19 views

Handling multiple listeners with a kind of identification

I develop a Android application for a Ble-Device and implement a Interface to listen on write, read and subscribe operations. I add all my listener instances to a List and trigger the Interface ...
developKinberg's user avatar
0 votes
1 answer
1k views

MainActivity can't cast interface

In MainActivity I have interface public interface MyListener{ void myMethod(boolean done); } but when I trying cast in onCreate myListener = (MyListener) this; I got java.lang....
purcha's user avatar
  • 371
1 vote
1 answer
24 views

Same code for all callback implementations in Java

I have a callback interface: public interface OnServerDoneListener { void onDone(int code, byte[] body); void onFailure(); } It's used as a listener for HTTP requests in many places across ...
Andrey Rankov's user avatar
1 vote
3 answers
1k views

Unable to update textview from callback method

I have an interface implemented in MainActivity, and inside that callback method i want to update my TextView but i am getting nullpointer exception. This is my MainActivity class public class ...
Akshay Katariya's user avatar

15 30 50 per page