Ask Me Help Desk

Ask Me Help Desk (https://www.askmehelpdesk.com/forum.php)
-   Other Scripting (https://www.askmehelpdesk.com/forumdisplay.php?f=455)
-   -   Nested If Statement (https://www.askmehelpdesk.com/showthread.php?t=754682)

  • Jun 20, 2013, 08:38 PM
    Symerion
    Nested If Statement
    I need a nested IF statement for this radiobutton and don't get how to connect it. Please help. I am attempted in assigned a radio button in java. This is my XML file with the radio button on it.
    Code:

        <RadioGroup
            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" >

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

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

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

    But my java file is coming up short,

    Code:

    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 what's to subscribe for... Any help out there?

  • All times are GMT -7. The time now is 09:21 PM.