I have setup a new android project with the default navigation drawer implemented for me. I created a custom NavagationDrawerAdapter which will return a more complex RelativeLayout for the first item of the navigation drawer. In this RelativeLayout, I have some buttons.
I have assigned the onclick attribute in the xml for these buttons to be addPhoto.
I then declared addPhoto thus in the MainActivity:
public void addPhoto(View view) {
Intent intent = new Intent(this, AddPhotoActivity.class);
startActivity(intent);
}
As I understand it, the navigation drawer is only a fragment and it resides in the MainActivity?
When I run the app it gives:
Could not find a method addPhoto(View) in the activity class android.view.ContextThemeWrapper for onClick handler on view class android.widget.ImageView with id 'imageView3'
It looks like it is using the activity ContextThemeWrapper or something...
How should I handle the onclick for an item in navdrawer?
Any help would be appreciated.