A member on my team generated stub fragments in Android Studio, and onAttach(Context context)
was automatically generated. However, the compiler reports the following errors in my code, shown below:
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
public class TestFragment extends Fragment {
...
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
}
error: method does not override or implement a method from a supertype
error: incompatible types: Context cannot be converted to Activity
Why am I getting these error messages at compile time?