How does the scope of using classes in Java work?
<p>I am not really sure how to word this question, so I did the best I could in that aspect. So I am having a problem with creating a <code>DatePicker</code> in my Activity. This is the code that is giving me an error:</p>

<p><strong>EditEventActivity.java</strong></p>

<pre><code>DateDialogFragment frag = DateDialogFragment.newInstance(this, new 
DateDialogFragmentListener() {

            @Override
            public void updateChangeDate(int year, int month, int day) {
                // TODO Auto-generated method stub

            }
        }, sYear, sMonth, sDay);
</code></pre>

<hr>

<p>The <code>newInstance()</code> method I have there is whats giving me the error. The error is this:</p>

<blockquote>
<pre><code>The method newInstance(Context, AddEventActivity.DateDialogFragmentListener, int, int,
int) in the type DateDialogFragment is not applicable for the arguments 
(EditEventActivity, new EditEventActivity.DateDialogFragmentListener(){}, int, int, 
int)
</code></pre>
</blockquote>

<hr>

<p>Now the <code>DateDialogFragment</code> is located in its own file. I don't think I need to post that. It is what it is. But my interface is in <code>AddEventActivity.java</code>. Now this is what I am confused about. My static method, <code>newInstance()</code> from DateDialogFragment takes <code>DateDialogFragmentListener</code>not <code>AddEventActivity.DateDialogFragmentListener</code>. So I assume thats what the problem is. But then again, I am not sure, which is what I need help understanding. Thanks you in advance.</p>

<p>Actually. I also figue I might as well include the <code>newInstance()</code> method:</p>

<p><strong>DateDialogFragment.java</strong></p>

<pre><code>public static DateDialogFragment newInstance(Context context, DateDialogFragmentListener 
listener, int year, int month, int day) {
    DateDialogFragment dialog = new DateDialogFragment();
    mContext = context;
    mListener = listener;
    mYear = year;
    mMonth = month;
    mDay = day;
    Bundle args = new Bundle();
    args.putString("title", "Set Date");
    dialog.setArguments(args);
    return dialog;
}
</code></pre>
