title: Get userinput value out of dialog function
body: <p>I want to get a simple String out of that dialog function into the variable "name".
  First AS tells me this: "Variable 'name' is accessed from within inner class, needs to be declared final". If i make it final it tells me a final value cannot be changed. I found some similar questions and tutorials already but they just display the user input with a toast or else. I need the value out of  there. This might be something elementary, but at the moment i can't get any further..</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
      TextView eventNameETMain = (TextView) findViewById(R.id.hello_world);
      String name;
  
      FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              View adView = getLayoutInflater().inflate(R.layout.dialog_new_event, null);
  
              AlertDialog.Builder eventNameAB = new AlertDialog.Builder(Main.this);
              eventNameAB.setView(adView);
              final EditText eventNameET = (EditText)adView.findViewById(R.id.eventNameET);
  
              eventNameAB.setCancelable(true).setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                  @Override
                  public void onClick(DialogInterface dialogInterface, int i) {
                      name = eventNameET.getText().toString();
                  }
              });
  
              AlertDialog dialog = eventNameAB.create();
              dialog.show();
          }
      });
  }
  </code></pre>