Ask Experts Questions for FREE Help !
Ask
    Symerion's Avatar
    Symerion Posts: 1, Reputation: 1
    New Member
     
    #1

    Jun 20, 2013, 08:38 PM
    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?

Check out some similar questions!

Nested slider for horizontal AND vertical movement together? [ 0 Answers ]

I want to understand if there's a jQuery or JavaScript package out there that allows both horizontal and vertical sliding of images/data at the same time in one nested slider? I'm having trouble finding a package that allows this to work effectively. It needs to have buttons to go up, down,...

Gmail nested labels. [ 2 Answers ]

I am using the Labs feature "Nested Labels". I can easily add a new label to an email and "nest it" under another existing label... But what I would like to do is go through current labels and assign them as nested under some other label. I'm not finding the answer in the Help section for...

Nested loop [ 1 Answers ]

How would I design a nested loop that displays 10 rows of # characters that should be 15 # characters in each row?

How could I put 2 conditions with COUNT IF Function and NESTED IF in Excel model [ 6 Answers ]

Hi, I am a new member, I hope you could help me to complete my assignment tonight, I am stock with "Count IF" function in Microsoft Excel 2003 How could I write the function with this commands: Count if the Tax which is (E15) not equal to 0, then I want to use a nested if with these...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.