You need to declare your OnClickListener
before you reference it...
View.OnClickListener mFan = new OnClickListener()
{
public void onClick(View v)
{
// stuff
}
};
button.setOnClickListener(mFan);
You also need your onCreateView
method to return a View
, so don't forget:
return rootView;
at the bottom of your onCreateView
method...
As a side note, you can accomplish the same thing using an anonymous listener like this:
button.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
// your stuff
}
});