I am new to programming, I have very basic knowledge in android. As I learned in java that an Interface cannot be instantiated And that new is a keyword in Java that indicates creating an instance. I came across following code in Android:
public class MyActivity extends Activity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
    setContentView(R.layout.mylayout);
    findViewById(R.id.button1).setOnClickListener(mButton1_OnClickListener);
  }  
  //On click listener for button1
  final OnClickListener mButton1_OnClickListener = new OnClickListener() {
    public void onClick(final View v) {
        //Inform the user the button has been clicked
        Toast.makeText(this, "Button1 clicked.", Toast.LENGTH_SHORT).show();               
    }
  };
}
Above code OnClickListener is a public interface and onClick(final View v) is an abstract method, Here goes my question: OnClickListener being an interface, how is possible to create an instance of it by using the new keyword in the example above?
 
     
     
     
    