Appcompat activity required as argument for function used in fragment
<p>I am using an external library in my app. The first argument used in the example is "this". Which refers to an appcompat activity. However I am using this in a fragment shich obviously doesn't extend appcompat activity.</p>

<p>This is the library:</p>

<p><a href="https://github.com/TouchBoarder/weekdays-buttons-bar" rel="nofollow noreferrer">https://github.com/TouchBoarder/weekdays-buttons-bar</a></p>

<p>I am not sure whether there is anything I can do. Can I extend the fragment to something compatible (right now it just extends fragment).</p>

<p>Below is a screenshot of the issue:</p>

<p><a href="https://i.stack.imgur.com/LdsQQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LdsQQ.png" alt="enter image description here"></a></p>

<p>EDIT:</p>

<p>This is what I extend in my MainActivity:</p>

<pre><code>public class MainActivity extends AppCompatActivity implements View.OnClickListener {
</code></pre>

<p>The Fragment that is called innside Main activity is extended like this:</p>

<pre><code>public class AddAlarmFragment extends Fragment {
</code></pre>

<p>And I am trying to create the data source in the oncreate method of the fragment like this:</p>

<pre><code>   @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
       // Inflate the layout for this fragment
       View view = inflater.inflate(R.layout.fragment_add_alarm, container, false);


        WeekdaysDataSource wds = new WeekdaysDataSource(, R.id.weekdays_stub)
                .start(this);



        new WeekdaysDataSource.Callback() {
            @Override
            public void onWeekdaysItemClicked(int attachId,WeekdaysDataItem item) {
                // Do something if today is selected?
                Calendar calendar = Calendar.getInstance();
                if(item.getCalendarDayId()==calendar.get(Calendar.DAY_OF_WEEK)&amp;&amp;item.isSelected())
                    Toast.makeText(getActivity(),"Carpe diem",Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onWeekdaysSelected(int attachId,ArrayList&lt;WeekdaysDataItem&gt; items) {
                //Filter on the attached id if there is multiple weekdays data sources
                if(attachId==R.id.weekdays_stub){
                    // Do something on week 4?
                }
            }

        };
</code></pre>

<p>Thanks in advance for your help.</p>