override empty method in custom view and handle it in MainActivity
<p>To make thinks simple, I have made a custom calendar view (RelativeLayout). Events (linearLayouts) are placed inside it. When I click on the event I want to be able to do something, but I want this something to be done in my MainActivity. In other words I want to override the empty method in my custom view and handle it in my MainActivity.</p>

<pre><code>                    eventView.setTag(event.getDatabaseId());
                    eventView.setOnClickListener(new OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            Log.d("test", "" + v.getTag());
                            onEventClick((int) v.getTag());
                        }
                    });
                    eventView.setOnLongClickListener(new OnLongClickListener() {
                        @Override
                        public boolean onLongClick(View v) {
                            onEventLongClick((int) v.getTag());
                            return false;
                        }
                    });
    }

...

    public void onEventClick(int eventId) {

    }

    public void onEventLongClick(int eventId) {

    }
</code></pre>

<p>So in my MainActivity I instantiate my view:</p>

<pre><code>    cv = ((CalendarView)findViewById(R.id.calendar_view));
</code></pre>

<p>I want to do something like:</p>

<pre><code>    cv = ((CalendarView)findViewById(R.id.calendar_view)) {
        @Override
        public void onEventClick(int eventId) {
            // here I will fetch the data and display a dialog
        }

        @Override
        public void onEventLongClick(int eventId) {
            // here I will fetch the data and display a dialog
        }
    };
</code></pre>

<p>I want to be able to use my calendar else where so this is why I don't want to tie the click functionality inside my custom view</p>

<p>I tried making my view abstract but got nowhere either.</p>

<p>EDIT: eventView's are in a viewpager</p>