As The Kenny said, this
is refering to the View.OnClickListener
instead of your Activity
. Change this, to MyActivity.this
.
For example,
public class MyActivity extends Activity {
// ... other code here
Toast.makeText(MyActivity.this, Lname, Toast.LENGTH_SHORT).show();