【发布时间】:2017-03-13 12:54:14
【问题描述】:
我已经扩展了 fragmentActivity 类,据我所知 onCreateView 在 fragmentActivity 的生命周期中可用,但它不应该调用超类,但它在@override 中给了我错误,要求我调用超类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
checkLocationPermission();
}
// Initializing
MarkerPoints = new ArrayList<>();
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override --> error Here
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_maps,
container, false);
Button button = (Button) view.findViewById(R.id.reportButton);
button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
Toast.makeText(getApplicationContext(),"Report Button Works",Toast.LENGTH_SHORT).show();
}
});
return view;
}
【问题讨论】:
-
错误是什么?日志? IDE?