Try using setOnClickListener to listen to click events
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
EditText abasic, ahra, aca, lopfd, lophd, la;
TextView ebasic, ehra, eca, agross, egross, loprs, hdrs, lars, td, spd, eepf, erpf, tpf, eeesi, eresi, tesi, pfesi;
Button calculate;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String[] months = {"Select a month", "January", "February", "February(Leap Year)", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
ArrayAdapter<String> monthadapter = new
ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, months);
Spinner dropdown = (Spinner) findViewById(R.id.month);
dropdown.setAdapter((monthadapter));
calculate = (Button) findViewById(R.id.button);
calculate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Do your calculation
}
});
}
}
solved I’m noob here. Need a little help to add values on EditText