title: local variable not used when declaring an editText java
body: <p>Hi im having trouble establishing the problem with my code. it compiles just fine but when launched and accessed in my app, the app crashes. when i edit the editText line of code the app runs completely fine. The error is get is that the local variable is never used. I have done and looked all i can to see similar topics regarding my issue but haven't found anything that could help. Here is the following code I am working on:</p>
  
  <pre><code>public class AddNewTask extends Activity implements OnClickListener {
  
  EditText name, date;
  
  @Override
  public void onCreate(Bundle savedInstanceState){
      super.onCreate(savedInstanceState);
      setContentView(R.layout.add_tasks);
  
      // set up click listeners for all the buttons
      View new_task_priority_button = 
                  findViewById(R.id.new_task_priority_button);
      new_task_priority_button.setOnClickListener(this);
  
      View addTask_button = findViewById(R.id.addTask_button);
      addTask_button.setOnClickListener(this);
  
      View cancel_button = findViewById(R.id.cancel_button);
      cancel_button.setOnClickListener(this);
  
      View View_button = findViewById(R.id.View_button);
      View_button.setOnClickListener(this);
  
      final EditText name = (EditText)findViewById(R.id.task_name);
      final EditText date = (EditText)findViewById(R.id.date); 
  }
  
  public void onClick(View arg0){
  
      switch (arg0.getId()){
      case R.id.new_task_priority_button:
          OpenPriorityDialog();
          break;          
      case R.id.View_button:
          break;      
      case R.id.addTask_button:
          break;          
      case R.id.cancel_button:
          break;
      }
  }
  </code></pre>
  
  <p>These lines cause my program to crash when accesed from my main menu, sqlName and sqlDate comes up with an error message saying local variable never used but I have declared them above.</p>
  
  <pre><code>   final EditText name = (EditText)findViewById(R.id.task_name);
     final EditText date = (EditText)findViewById(R.id.date); 
  </code></pre>
  
  <p>If anyone could help me out or point me in the right direction I would be very grateful</p>