title: tag cannot be resolved to a variable
body: <p>I have a tag resolving error which I have beeen trying to slove but all in vain,
  I want to move data from one activity to another but I am getting this error:</p>
  
  <p>------>    "tag cannot be resolved to a variable"</p>
  
  <pre><code>Button ok = (Button) findViewById(R.id.ok);
  ok.setOnClickListener(new View.OnClickListener() {
      public void onClick (View view) {
          Intent newActivity = new Intent(view.getContext(), home.class);
          newActivity.putExtra("NAME", name);
          startActivity(newActivity);
          Log.d(TAG, name);
      }  
  });
  </code></pre>
  
  <p><strong>UPDATED CODE:</strong></p>
  
  <p>LoginActivity1.java</p>
  
  <pre><code>import java.util.ArrayList;
  import org.apache.http.HttpResponse;
  import org.apache.http.NameValuePair;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.methods.HttpGet;
  import org.apache.http.client.protocol.ClientContext;
  import org.apache.http.cookie.CookieOrigin;
  import org.apache.http.cookie.CookieSpec;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.message.BasicNameValuePair;
  import org.apache.http.protocol.BasicHttpContext;
  import org.apache.http.protocol.HttpContext;
  
  import android.app.Activity;
  import android.content.Intent;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.TextView;
  import com.trekeyes.android.CustomHttpClient;
  
  public class LoginActivity1 extends Activity { 
  
      Button btnLinkToRegistrScrn; 
      Button loginbtn1;
      Button cancelBtn;
      TextView error;
      EditText LgnTxt, LgnPsw; 
      public static DefaultHttpClient httpClient;
      public static String TAG="LoginActivity1";
  
      /** Called when the activity is first created. */ 
      @Override 
      public void onCreate(Bundle savedInstanceState) { 
          super.onCreate(savedInstanceState); 
       setContentView(R.layout.login); 
       LgnTxt = (EditText) findViewById(R.id.editTextLgnEmail);
       LgnPsw = (EditText) findViewById(R.id.editTextLgnPassword);
       error = (TextView)findViewById(R.id.login_error1);
       addListenerOnButton(); 
  
  
       // Link to Register Screen  
          btnLinkToRegistrScrn = (Button) findViewById(R.id.LinkToRegisterScreen);  
          btnLinkToRegistrScrn.setOnClickListener(new View.OnClickListener() {  
             @Override 
              public void onClick(View v) {  
                 finish();
                  Intent i = new Intent(v.getContext(), Activity.class);  
                  startActivity(i); 
                  }});
  
  
       // Link to Cancel Button 
          cancelBtn = (Button) findViewById(R.id.btnCancelLgn);  
          cancelBtn.setOnClickListener(new View.OnClickListener() {  
             @Override 
              public void onClick(View v) {  
                 finish();
                //  Intent i = new Intent(v.getContext(), PageApp.class);  
                //  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
                //  startActivity(i); 
                  }  
         });
     } 
      public void addListenerOnButton() { 
  
               loginbtn1 = (Button) findViewById(R.id.btnLogin); 
  
              loginbtn1.setOnClickListener(new View.OnClickListener() { 
  
              @Override 
              public void onClick(View arg0) { 
  
                  ///////// Database Handling
  
                  // TODO Auto-generated method stub
  
  
                 ArrayList&lt;NameValuePair&gt; postParameters = new ArrayList&lt;NameValuePair&gt;();
                     postParameters.add(new BasicNameValuePair("email", LgnTxt.getText().toString()));
                     postParameters.add(new BasicNameValuePair("password", LgnPsw.getText().toString()));
  
                     String response = null;
                     try {
                               response = CustomHttpClient.executeHttpPost("http://10.0.2.2/db/lgn.php", postParameters);  
                         String res=response.toString();
                     res= res.replaceAll("\\s+","");
                     if(res.equals("1"))
                     {
                         error.setText("Correct Email And Password");
                                Intent intent = new Intent(arg0.getContext(), boardAct.class); 
                                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
                                  intent.putExtra("EMAIL", LgnTxt.getText().toString());
                                  startActivity(intent);
                                  Log.d(TAG,LgnTxt.getText().toString());
                                  finish(); 
                     }
  
                     else
                     error.setText("Sorry!! Incorrect Email or Password");
  
                     } catch (Exception e) {
  
                     LgnTxt.setText(e.toString());
                     }           
  
        }
  
          }); 
      } 
  
   }
  </code></pre>
  
  <p>boardAct.java</p>
  
  <pre><code>public class boardAct extends MapActivity {
  
      public static String TAG="boardAct";
  
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.dashboard);
  }
  </code></pre>
  
  <p>settings.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical" &gt;
  
      &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="1dip"
              android:layout_marginTop="0dp"
              android:text="@string/accountSettings"
              android:textSize="25sp"
              android:layout_gravity="center"
              android:textStyle="bold" /&gt;
      &lt;TextView
              android:id="@+id/txtlabellogSetting"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="1dip"
              android:layout_marginTop="6dp"
              android:state_enabled="false"
              android:textSize="15sp"
              android:text="@string/labelsettings"
              android:layout_gravity="center"
              android:textStyle="bold" /&gt;
      &lt;TextView
              android:id="@+id/txtboxlogSetting"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginBottom="1dip"
              android:layout_marginTop="6dp"
              android:state_enabled="false"
              android:textSize="15sp"
              android:layout_gravity="center"
              android:textStyle="bold" /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Setting.java</p>
  
  <pre><code>public class AccSettingsActivity extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.settings);
          addListenerOnButton();    
      }
  
      private void addListenerOnButton() {
          // TODO Auto-generated method stub
  
            ///////////// For TxtlogSetting  ////////////
  
              TextView logText = (TextView) findViewById(R.id.txtboxlogSetting); 
              String email = getIntent().getStringExtra("EMAIL"); 
              logText.setText("email");   
     }
  </code></pre>