public class MyButton {
    public interface MyListener {
      // you can define any parameter as per your requirement
      public void callback(View view, String result);
   }
    MyListener ml;

    // constructor
    MyButton(MyListener ml) {
        this.ml = ml;
    }

    public void MyLogicToIntimateOthere() {
        ml.callback(this, "success");
    }
}
public class MyActivity extends Activity implements MyListener {
   @override        
   public void onCreate(){
        MyButton m = new MyButton(this);
   }

    // method invoke when mybutton will click
    @override
    public void callback(View view, String result) {   
      System.out.println(result);
    }
}

By admin-powenko

Dr. Powen Ko is a teacher and CEO on LoopTek LLC, and like to teaching. if you need to class, please let PowenKo know, he will love to service and sharing. LoopTek web site is www.looptek.com

Leave a Reply