Android Saving EditText text in a PopupWindow to a Class Member string
<p>I'm trying to locally save an edittext text into a string variable I have created in another class within a PopupWindow like so:</p>

<p>I have an addEvent_Click method which displays a PopupWindow :</p>

<pre><code>public void addEvent_Click(View view)
{
    LayoutInflater inflater = (LayoutInflater) WhatsNewActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    eventPopup = new PopupWindow(inflater.inflate(R.layout.eventpopup, null, true), 480, 700, true);

    eventPopup.showAtLocation(findViewById(R.id.whatsNew_Main), Gravity.CENTER_VERTICAL, 0, 0);
}
</code></pre>

<p>Now I want to save all my text fields locally to an event class via save button press in the PopupWindow like so:</p>

<pre><code>    public void btnSaveEvent_Click(View view)
{
    final EditText nameEditText = (EditText) findViewById(R.id.nameEditText);
    final EditText timeEditText = (EditText) findViewById(R.id.timeEditText);
    final EditText locEditText = (EditText) findViewById(R.id.locEditText);
    final EditText sDateEditText = (EditText) findViewById(R.id.sDateExitText);
    final EditText eDateEditText = (EditText) findViewById(R.id.eDateEditText);
    final EditText catEditText = (EditText) findViewById(R.id.catEditText);

    Event newEvent = new Event();

    newEvent.eventName = nameEditText.getText().toString();
    newEvent.time = timeEditText.getText().toString();
    newEvent.location = locEditText.getText().toString();
    newEvent.startDate = sDateEditText.getText().toString();
    newEvent.endDate = eDateEditText.getText().toString();
    newEvent.category = catEditText.getText().toString();


    eventPopup.dismiss();
}
</code></pre>

<p>My problem is when I debug or run the code and it tries to execute the line:</p>

<pre><code>        final EditText nameEditText = (EditText) findViewById(R.id.nameEditText);
</code></pre>

<p>my program crashes throwing an IllegalStateException error: Could not execute method of the activity</p>

<p>Any input would be appreciated, Thanks in advance.</p>
