title: The constructor AlertDialog.Builder(TitleLayout) is undefined
body: <p>i have created a titile_layout.xml, and i want to use TitleLayout into Mainactivity. But when i create a AlertDialog when i press a button, there is a error as below. i think maybe is there something wrong with "TitleLayout.this"? but if i do not use it, what should i use? why?</p>
  
  <pre><code>package cn.example.uilayouttest;
  
  import android.app.AlertDialog;
  import android.app.AlertDialog.Builder;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
  import android.util.AttributeSet;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.widget.Button;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  
  public class TitleLayout extends LinearLayout  {
  
      public TitleLayout(Context context, AttributeSet attrs) {
          super(context, attrs);
  
          LayoutInflater.from(context).inflate(R.layout.title_layout, TitleLayout.this);
  
          Button btn1 = (Button) findViewById(R.id.button1);
          Button btn2 = (Button) findViewById(R.id.button2);
          TextView tv = (TextView) findViewById(R.id.text_view);
  
          btn1.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // The wrong is here:The constructor AlertDialog.Builder(TitleLayout) is undefined
                  AlertDialog.Builder ad = new AlertDialog.Builder(TitleLayout.this);
                  ad.setTitle("fefsfs");
                  ad.setMessage("fefwefw");
                  ad.setPositiveButton("fefw", new DialogInterface.OnClickListener() {
  
                      @Override
                      public void onClick(DialogInterface dialog, int which) {
                          // TODO Auto-generated method stub
  
                      }
                  });
                  ad.show();
              }
          });
          btn2.setOnClickListener(new View.OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
              }
          });
  
  
      }
  //  public void onclick ()
  
  }
  </code></pre>