Here is my AddLift.java:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_lift);
final EditText Origin = (EditText)findViewById(R.id.addOrigin);
final EditText Destination =
(EditText)findViewById(R.id.addDestination);
final EditText Time = (EditText)findViewById(R.id.setTime);
final EditText Seats = (EditText)findViewById(R.id.numOfSeats);
final RadioGroup DriverLifter = (RadioGroup)findViewById(driverLifter);
final RadioButton selectedButton =
(RadioButton)findViewById(selectedButton);
Button submit = (Button)findViewById(R.id.submitButton);
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String addOrigin = Origin.getText().toString();
String addDestination = Destination.getText().toString();
String setTime = Time.getText().toString();
String numOfSeats = Seats.getText().toString();
int selectedId = DriverLifter.getCheckedRadioButtonId();
selectedButton = (RadioButton)findViewById(selectedId);
Intent intent = new Intent(AddLift.this, ViewLiftBoard.class);
intent.putExtra("ORIGIN", addOrigin);
intent.putExtra("DESTINATION", addDestination);
intent.putExtra("TIME", setTime);
intent.putExtra("SEATS", numOfSeats);
intent.putExtra("RADIO", driverLifter);
startActivity(intent);
}
});
And here is my ViewLiftBoard.java:
public class ViewLiftBoard extends AppCompatActivity {
String Origin;
String Destination;
String Time;
String Seats;
int DriverLifter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_lift_board);
Origin = getIntent().getExtras().getString("ORIGIN");
Destination = getIntent().getExtras().getString("DESTINATION");
Time = getIntent().getExtras().getString("TIME");
Seats = getIntent().getExtras().getString("SEATS");
DriverLifter = getIntent().getExtras().getInt("RADIO");
TextView textView = (TextView)findViewById(R.id.textView);
textView.setText("Origin:"+ "
"+Origin+'\n'+"Destination:"+""+Destination+'\n'+"Time:"+"
"+Time+'\n'+"Number of Seats:"+" "+Seats+'\n'+"Type:"+" "+DriverLifter);
}
}
But when I run the app the "Type" comes up as a number rather than the value of the selected radio button? Any help would be great