can anyone tell me if I am right or wrong? I am really getting confused in solving my problem.
What I have is (or what I want to do Or am thinking is:)
I have:
Class B{
........
........
interface I{
......
........
}
.......
.......
}
and :
Class A implements B.I{
........
.......
B b= new B();
}
Is it the right way of communication between two classes class B and Class A? how should i make this work. I want some data from class A passed to class B for further operations.
how should i make the methods that i will implement in A get called from B when i require the data? A simple example on an Interface having same scenario will really help me. Doea anyone have a good explanation on how interface work? or how should they be used?
I would also further like to ask logic behind working of interfaces in android..? what is the logic behind callback methods that we have in OnClick Listeners? because this also is carried out using interfaces? for ex: we implement them in our class
class A implements View.OnClickListener
and provide the logic in our class for handling onClick events? So when are they called .(I know they are called when we click on that particular view) i want the mechanism or implementation of how they are called
or maybe i should do this using abstract class ? i am really stuck! Thankyou