How to Send Data By Using Interface In Android

1.First Create Interface an Always remember that Interface is Always public.

public interface MyInterface
{
    public void value(String abc);
}


2.then use that interface where you want to use.


String nameValues="Ganesh Divekar";
MyInterface myInterface = (MyInterface)context;
myInterface .value(nameValues);

 

3.then we need to implement we created Interface where you want to needed.

implements MyInterface;

@Override
public void value(String abc) {
    NameValue.setText(abc);
}

 

 


Leave a comment