balysv / material-ripple

Android L Ripple effect wrapper for Views
Apache License 2.0
2.36k stars 479 forks source link

onclick listener help #59

Open kashifandroiddev opened 8 years ago

kashifandroiddev commented 8 years ago

how can i implement setonclick listener in normal way

mMrOflineSync.setOnClickListener(this);

then handle like

@Override public void onClick(View v) { switch (v.getId()) { case R.id.materiallayout:

            break;
    }
}

i did test it that way but not working only works when i do it that way

    findViewById(R.id.syndata_syndata_rpv).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
             requploadpic(mContext, mRoot);
        }
    });

thanks for your help

callmepeanut commented 8 years ago

@kashifandroiddev If you look in the source you will found:

        if (childView == null) {
            throw new IllegalStateException("MaterialRippleLayout must have a child view to handle clicks");
        }
        childView.setOnClickListener(onClickListener);

So, your case id should be the id of the child, hope it helps.