Eso ni siquiera debería de compilar.
Código Java:
Ver originalpublic class MainActivity extends Activity {
TextView display;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
display = (TextView)findViewById(R.id.tvDisplay);
calcular
= (Button)findViewById
(R.
id.
calcularButton); // Reemplazar por tu ID
calcular.
setOnClickListener(new View.
OnClickListener() { public void onClick
(View view
) { display.setText("" + MainActivity.gcd(8, 10));
}
});
}
public static int gcd(int a, int b) {
if (b==0) return a;
return gcd(b,a%b);
}
}