title: Where should I declare my variables?
body: <p>When declaring my variables at the beginning of the class, I can't use them in a conditional statement in other methods.
  I tried declaring them inside the method it works but I can't use the variables outside the method.</p>
  
  <p>This is a sample of my code </p>
  
  <pre><code>protected void onClick(View v){
    switch(v.getId()){        
      int counter;
      case R.id.btsend:
        for (int i = 0;i&lt;=0;i++){          
          if (true)
            counter += 1;          
        }
  
      TextView.setText(counter);
  
      break;
    }
  }
  </code></pre>