All Questions
15 questions
3
votes
1
answer
124
views
Login system using callbacks in android
I wrote a login system for an app I am developing, but I'm not really happy with the code I have at the moment. I feel like there is a better way at tackling a problem like this. In particular I'm not ...
4
votes
3
answers
7k
views
Simple Publisher Subscriber in Java
I am new to Java and had some difficulty creating this simple Publisher Subscriber class. It finally seems to be working and I wanted to check if I have been following best practices and see if there ...
2
votes
2
answers
401
views
Read lines from file, calling a consumer function for each line
I wrote a function for iterating over a large file with performance in mind. It takes in an InputStream and reads until it reaches the end of the file. Whenever it ...
2
votes
1
answer
678
views
Event Handler Registration in Java [closed]
I have a stateful object on which I'd like client code to be able to register many event handlers. These handlers have different signatures—they usually accept the originating object and some piece of ...
10
votes
1
answer
709
views
ActivityLifecycleHelper implementation
Description
The ActivityLifecycleHelper uses wrap(Context)to create the class and save a global ...
5
votes
2
answers
3k
views
Synchronization in an event manager
I'm working on an event manager, and I am wanting it to be a tool developers use. It is lightweight and it uses annotations to register events. I've tried to set up ...
1
vote
1
answer
88
views
Is this a proper callback implementation in Java?
I have a code which I believe is callback implementation. Can you please provide your more experienced opinions on whether this is a good way to ...
7
votes
2
answers
22k
views
Callback on AlertDialog
I am using an AlertDialog in Android, asking the user for some input. I would like do run some code when the user has finished entering her input.
Since an ...
4
votes
2
answers
14k
views
Generic callback object, but I need the type parameter inside methods
Inside my android app, I currently have methods that look like below code. Since they all need a callback object that basically does the same thing and I would like to try to eliminate the duplicated ...
7
votes
4
answers
470
views
Identify Java Callback
I have this common design in my application:
...
6
votes
2
answers
78
views
Alternate way for comparison call back function?
I'm doing a programming practice problem and was wondering if someone can suggest a better to create/setup the call back for the comparison function. I have the following classes:
...
2
votes
2
answers
165
views
Allowing messages to be passed to listeners [closed]
I have written an implementation of the observer pattern that allows messages to be passed to listeners in what would normally be the notify() method. For example a ...
5
votes
1
answer
911
views
"Piping" from a callback to an Iterator
My project has a central concept of a Callback<T> which is defined very simply:
...
3
votes
1
answer
5k
views
Efficient implemetation of AlertDialog callback in Android
One day I realised that my Android project utilizes AlertDialogs here and there in very ineffective way. The heavily duplicated portion of code looked like this (actually, copied and pasted from some ...
36
votes
2
answers
6k
views
Asynchronous network callback code
I did not get the job after submitting this piece of work in an interview, but I have no feedback to know what "BAD" things are inside this block of code.
The requirements are:
Connect to the ...