title: Handling Button and EditText to Send an SMS
body: <p>I want to handle an EditText and a button in my listView to send an sms. 
  So far, the phone Numbers are entered by the user. So, I have made an adapter as the following : </p>
  
  <pre><code>public class ListViewStudentWithDateAdapter extends ArrayAdapter&lt;ListViewStudentWithDate&gt; {
  private Context mContext;
  private ArrayList&lt;ListViewStudentWithDate&gt; mData;
  private EditText Parent_Number ;
  
  public ListViewStudentWithDateAdapter (Context mContext, ArrayList&lt;ListViewStudentWithDate&gt; mData)
  {
      super(mContext, R.layout.student_list_with_date_shape, mData);
      this.mContext = mContext;
      this.mData = mData;
  }
  public int getCount() {
      return mData.size();
  }
  
  @Override
  public long getItemId(int position) {
      return position;
  }
  
  @Override
  public View getView(final int position, View convertView, ViewGroup parent)
  {
      if (convertView == null) {
          LayoutInflater mInflater = (LayoutInflater)
                  mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
          convertView = mInflater.inflate(R.layout.student_list_with_date_shape, null);
      }
      TextView Name  = (TextView) convertView.findViewById(R.id.Name);
      Name.setText(mData.get(position).getStudent_name());
  
      TextView GRADE  = (TextView) convertView.findViewById(R.id.GRADE_ID);
      GRADE.setText(mData.get(position).getGrade_id());
  
      TextView CLASS  = (TextView) convertView.findViewById(R.id.CLASS_ID);
      CLASS.setText(mData.get(position).getCLass_id());
  
      Parent_Number  = (EditText) convertView.findViewById(R.id.Father_number);
  
      Button Send_Father = (Button) convertView.findViewById(R.id.Send_Father);
      Send_Father.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Log.i("Send SMS", "");
              String phoneNo = Parent_Number.getText().toString();
              String sms = "HELLO World" ;
              try {
                  // Get the default instance of the SmsManager
                  SmsManager smsManager = SmsManager.getDefault();
                  smsManager.sendTextMessage(phoneNo,
                          null,
                          sms,
                          null,
                          null);
                  Toast.makeText(getContext(), "Your sms has successfully sent!",
                          Toast.LENGTH_LONG).show();
              } catch (Exception ex) {
                  Toast.makeText(getContext(),"Your sms has failed...",
                          Toast.LENGTH_LONG).show();
                  ex.printStackTrace();
              }
          }
      });
      return convertView;
  }
  
   }
  </code></pre>
  
  <p>It doesn't seem to be working because it always gives me the failure message. Any idea ??</p>