mardi 31 janvier 2017

Trying to add "label" to CheckBox Responses Plus App Keeps Shutting Down

Good Evening,

I am trying to create an app that features three radio buttons, two checkboxes and two buttons. The app must feature three "labels" or responses to the user pushing a button or checking a checkbox etc. Now for my two buttons I have successfully completed the needed coding for the UPS or FedEx buttons to send the user to their respective websites. For my final label, I want the response to the checkboxes being checked to be "Your extra item has been added to your cart total," or something along those lines. I know I need an On set listener but I am not sure where or how to string that into my code. Also, every time I try to use the radio buttons or check boxes, the app closes and I am not sure what I am missing. Thank you for the help in advance.

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;



@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

public void UPS (View view) {
    goToUrl ( "http://www.ups.com/");
}

public void FedEx (View view) {
    goToUrl ( "http://www.fedex.com/");
}

private void goToUrl (String url) {
    Uri uriUrl = Uri.parse(url);
    Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
    startActivity(launchBrowser);
}

}




Aucun commentaire:

Enregistrer un commentaire