title: Accessing variables from another class Android Studio
body: <p>I'm new to android development and I'm wondering how this can be done. I have a class named ListDeadlines with variables such as </p>
  
  <pre><code>public ArrayList&lt;String&gt; arrayList;
  public ArrayAdapter&lt;String&gt; adapter;
  public EditText txtInput;
  </code></pre>
  
  <p>I want to be able to access these variables in a different class. I have tried it like this, however I get the fallowing error on my <code>lst.txtInput lst.arrayList lst.adapter</code> saying <code>Variable 'lst' is accessed from within inner class, needs to be declared final.</code> Anyone got any ideas on how to access variables in another class.</p>
  
  <pre><code>    ListDeadlines lst= new ListDeadlines();
      getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  
      lst.txtInput=(EditText)findViewById(R.id.txtinput);
      Button btAdd=(Button)findViewById(R.id.btnAdd);
      btAdd.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              String newItem = lst.txtInput.getText().toString();
             lst.arrayList.add(newItem);
              lst.adapter.notifyDataSetChanged();
              ;
          }
      });
  </code></pre>