title: Passing value from one activity to another using intent
body: <p>I am making an application in which I have taken 2 screens; Screen A and Screen B. In both the screens, I have taken an edit text and a text view. </p>
  
  <p>In edit text of Screen A, I am taking mobile number which by clicking on text view I am sending it to Screen B and setting it on edit text of Screen B. This process is working successfully.</p>
  
  <p>This is my code on Screen A - </p>
  
  <pre><code>    tvredeem.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
     // TODO Auto-generated method stub
     Intent i = new Intent(getApplicationContext(),
       RedeemPoints.class);
      i.putExtra(mobileno1, mobileno1);
     startActivity(i);
    }
   });
  </code></pre>
  
  <p>This is my code on Screen B - </p>
  
  <pre><code>      mobileno = (EditText) findViewById(R.id.mobileno);
      Bundle bundle = getIntent().getExtras();
       String message = bundle.getString("mobileno1");
      mobileno.setText(message);
  </code></pre>
  
  <p>Now, the problem is when I am coming striaght to Screen B, it is giving null pointer exception on this line -  <B>mobileno.setText(message); </B>
  and the application is forcefully shutting down. </p>
  
  <p>What 'if' condition should I use that when I come on Screen B, it doesn't give null pointer exception and edit text should be blank.</p>
  
  <p>The code below should work when I directly come on Screen B.
  When text is set on editText of Screen B, I want to run this code...</p>
  
  <pre><code> mobileno.addTextChangedListener(new TextWatcher() {
  
   @Override
    public void onTextChanged(CharSequence s, int start, int before,
   int count) {
  // TODO Auto-generated method stub
  String inputNo = s.toString();
  if (inputNo.length() == 10) {
   getmobno = inputNo;     
    new Homedata().execute();     
   }   
   }
  
   @Override
   public void beforeTextChanged(CharSequence s, int start, int count,
    int after) {
   // TODO Auto-generated method stub
   }
  
   @Override
   public void afterTextChanged(Editable s) {
   // TODO Auto-generated method stub
    }
  }  );
  </code></pre>