Listing 9.10 generic Superclass Override Error


#1

I am using Android Studio and am trying to display the List of Crimes.

[code]package com.example.bdpudlo.criminalintentas;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;

/**

  • Created by bdpudlo on 7/17/2014.
    */
    public abstract class SingleFragmentActivity extends FragmentActivity {
    protected abstract Fragment createFragment();

    @Override
    public void OnCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fragment);
    FragmentManager fm = getSupportFragmentManager();
    Fragment fragment = fm.findFragmentById(R.id.fragmentContainer);

     if (fragment == null){
         fragment = createFragment();
         fm.beginTransaction()
                 .add(R.id.fragmentContainer,fragment)
                 .commit();
     }
    

    }
    }
    [/code]

This is the error from Android Stuido
Error:(15, 5) error: method does not override or implement a method from a supertype

Since I could not use the New Java Class wizard I am not sure I am doing this correctly. Kindle Edition 28% page 174 of 585 Location 4188 of 15398

From the error I am not referencing the OnCreate anywhere. Where should I be calling it from?


#2

Chaning:

@Override public void OnCreate(Bundle savedInstanceState){

to

@Override protected void onCreate(Bundle savedInstanceState) {

Solved the issue.