implements TopSectionFragment Cannot resolve symbol android studio
<pre><code>public class MainActivity extends AppCompatActivity implements
    TopSectionFragment.TopSectionListener {
</code></pre>

<p>When I try to implement the <code>TopSectionFragment</code> the writing goes red and, then it says <code>Cannot resolve symbol</code> when my mouse goes over it.</p>

<p>This is all happening in Android Studio.</p>

<p><strong>My MainActivity.java looks like this:</strong></p>

<pre><code>package com.example.danielhunter.fragments;

import android.support.v7.app.AppCompatActivity;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;`


public class MainActivity extends AppCompatActivity
    implements TopSectionFragment.TopSectionListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}
</code></pre>

<p><strong>My TopSectionFragment.java looks liks this:</strong></p>

<pre><code>import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.ViewGroup;
import android.view.View;
import android.view.LayoutInflater;
import android.support.v4.app.Fragment;
import android.widget.Button;
import android.widget.EditText;
import android.app.Activity;

import com.example.danielhunter.fragments.R;


public class TopSectionFragment extends Fragment {

private static EditText topTextInput;
private static EditText bottomTextInput;

TopSectionListener activityCommander;

    public interface TopSectionListener{
    public void createMeme(String top,String bottom);


    }


    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        try{
        activityCommander = (TopSectionListener) activity;

        }catch (ClassCastException e){
            throw new ClassCastException(activity.toString());
        }



    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        View view = inflater.inflate(R.layout.top_section_fragment, container, false);

        topTextInput = (EditText) view.findViewById(R.id.topTextInput);
        bottomTextInput = (EditText) view.findViewById(R.id.bottomTextInput);

        final Button button = (Button) view.findViewById(R.id.button);


        button.setOnClickListener(
                new View.OnClickListener(){
                    public void onClick(View v){
                        buttonClicked(v);


                    }
                }
        );



        return view;



    }
    // calls this when the button is clicked
    public void buttonClicked(View view){
    activityCommander.createMeme(topTextInput.getText().toString(), bottomTextInput.getText().toString());

    }

    }
</code></pre>