-3
Le code lance erreur de compilation de temps:OnLongClickListiner ne fonctionne pas
Class 'Anonymous class derived from OnLongClickLister' is not abstract and does not override abstract method onLongClick(View) in OnLongClickListener
code:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button amitsbutton = (Button) findViewById(R.id.amitsbutton);
amitsbutton.setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
TextView amitstext = (TextView) findViewById(R.id.amitstext);
amitstext.setText("Small click is working");
}
}
);
amitsbutton.setOnLongClickListener(
new Button.OnLongClickListener() {
public boolean OnLongClick(View v) {
TextView amitstext = (TextView) findViewById(R.id.amitstext);
amitstext.setText("long click is also working ");
return true;
}
}
);
'@ Override' le' onLongClick'method – tahsinRupam
et return false de setOnClickListener onClick – Rasel
pourquoi devrait-il revenir faux? Il devrait retourner vrai puisque le clic a été consommé – quiro