Here is my Code ...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView) findViewById(R.id.textView);
text.setText("Application Created");
btn1 = (Button) findViewById(R.id.Mybutton);
btn1.setOnClickListener(this);
btn2 = (Button) findViewById(R.id.btn2);
btn2.setOnClickListener(this);
btn1.setOnLongClickListener(**this**);*(Error Generated here)*
}
public boolean onLongClick( View v)
{
return true;
}
i am trying to use on long click listener on more than two buttons and handle them in a single method (public boolean onLongClick(View v)) by using switch case. I tried my code but their is an error generated when i pass btn1.setOnLongClickListener(this); "this" in the braces" i am handling this event in the same class.