Rohan Sharma Rohan Sharma - 5 months ago 31
Android Question

Getting an error: onCreate(Bundle) in class clashes with onCreate(Bundle) in android.support.v4.app.Fragment

I have made a class

Navigation
which extends
Fragment
. When I'm using
onCreate()
method it is giving me error saying
onCreate()
method of the class clashes with the
onCreate()
method of
android.support.v4.app.Fragment
.

package com.beacons.railwayaid.tablayoutapp;

import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.customlbs.library.IndoorsFactory;
import com.customlbs.surface.library.IndoorsSurfaceFactory;
import com.customlbs.surface.library.IndoorsSurfaceFragment;


public class Navigation extends Fragment {



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

IndoorsFactory.Builder indoorsBuilder = new IndoorsFactory.Builder();
IndoorsSurfaceFactory.Builder surfaceBuilder = new IndoorsSurfaceFactory.Builder();

indoorsBuilder.setContext(getContext());

indoorsBuilder.setApiKey("69af5e85-007a-4df5-8715-d1c2c22e206f");



indoorsBuilder.setBuildingId((long) 979231679);

surfaceBuilder.setIndoorsBuilder(indoorsBuilder);

IndoorsSurfaceFragment indoorsFragment = surfaceBuilder.build();

FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.add(android.R.id.content, indoorsFragment, "indoors");
transaction.commit();
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.tab2_railway_navigation, container, false);

return rootView;
}
}

Answer Source

Change:

@Override
protected void onCreate(Bundle savedInstanceState) {
    ...
}

to:

@Override
public void onCreate(Bundle savedInstanceState) {
    ...
}