Skip to main content

Android App project-Radio button issues

No replies
Symerion
Offline
Joined: 2013-06-19
Points: 0

I am attempted in assigned a radio button in java. This is my XML file with the radio button on it.
android:id="@+id/radMovies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/txtMonths"
android:layout_below="@+id/txtMonths"
android:layout_marginLeft="26dp"
android:layout_marginTop="17dp" >

android:id="@+id/radMail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DVD Movies by Mail: $8.99" />

android:id="@+id/radStream"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="Streaming Movies: $7.99" />

android:id="@+id/radCombined"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Combined Services: $15.99" />

But my java file is coming up short,

double Mail = 7.99;
double Steam = 8.99;
double Combined = 15.99;
int numberOfMonths;
double TotalCost;
private RadioGroup radMovie;
private RadioButton radMovieButton;
private Button btnDisplay;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final EditText Months=(EditText) findViewById(R.id.txtMonths);
final RadioButton Mail = (RadioButton) findViewById(R.id.radMail);
final RadioButton Stream = (RadioButton) findViewById(R.id.radStream);
final RadioButton Combined = (RadioButton) findViewById(R.id.radCombined);
final TextView result = (TextView) findViewById(R.id.txtResults);
Button cost = (Button) findViewById(R.id.btnTotalCost);
cost.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
numberOfMonths = Integer.parseInt(Months.getText().toString());
}
});
Toast.makeText(MainActivity.this, "Months must be less than 24", Toast.LENGTH_SHORT);
DecimalFormat Currency = new DecimalFormat("$###,###.##");
}

I am missing how to make the radiobuttons multiply by the number of months someone whats to subscribe for.......Any help out there?